home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / basic / bc7tb523.zip / DEMON.BAS < prev    next >
BASIC Source File  |  1992-05-12  |  89KB  |  2,184 lines

  1. ' DEMON.BAS     this program illustrates some of the ways that the routines
  2. '               provided in the Libraries in this package, can enhance your
  3. '               Extended QuickBASIC programs.
  4. '
  5. '   Author:     Christy Gemmell
  6. '   For:        Assembly-Language Toolbox for QuickBASIC
  7. '   Version:    5.23
  8. '   Date:       29/4/1992
  9. '
  10. '   For MicroSoft QuickBASIC and BASIC 7 Professional Development System.
  11. '   Assembler routines created with MicroSoft Macro Assembler MASM 6.0
  12. '
  13. '   Compile:    BC /E/Fs/O/S/X demon;
  14. '   Link:       Link /E/F demon,,,toolbox.lib mixed.lib;
  15. '
  16. '   $DYNAMIC                             ' required for stringsort routine
  17. '
  18. '┌────────────────────────────────────────────────────────────────────────┐
  19. '│      External Functions and Procedures.                                │
  20. '└────────────────────────────────────────────────────────────────────────┘
  21. '
  22. '   The following prototypes refer to assembly-language procedures which
  23. '   are in the library files TOOLBOX.LIB and TOOLBOX.QLB. One or other of
  24. '   these libraries must be linked to the program which calls them.
  25. '
  26.     DECLARE FUNCTION Attribute% (BYVAL Fore%, BYVAL Back%)
  27.     DECLARE FUNCTION CapsLock% (BYVAL Switch%)
  28.     DECLARE FUNCTION Cpu% ()
  29.     DECLARE FUNCTION EmsError% ()
  30.     DECLARE FUNCTION EmsFrame% ()
  31.     DECLARE FUNCTION EmsOwned% (BYVAL Handle%)
  32.     DECLARE FUNCTION EmsPages% (BYVAL Switch%)
  33.     DECLARE FUNCTION EmsPresent% ()
  34.     DECLARE FUNCTION EmsVersion% ()
  35.     DECLARE FUNCTION FarPeek% (BYVAL Segment&, BYVAL OffSet&)
  36.     DECLARE FUNCTION FreeSpace& (BYVAL DriveNo%)
  37.     DECLARE FUNCTION KeyFlags% ()
  38.     DECLARE FUNCTION KeyIn% ()
  39.     DECLARE FUNCTION KeyStat% ()
  40.     DECLARE FUNCTION MathsChip% ()
  41.     DECLARE FUNCTION MouseInit% ()
  42.     DECLARE FUNCTION NumLock% (BYVAL Switch%)
  43.     DECLARE FUNCTION PeekWord& (BYVAL Segment&, BYVAL OffSet&)
  44.     DECLARE FUNCTION PrinTest% (BYVAL Printer%)
  45.     DECLARE FUNCTION Rand% (BYVAL Lower%, BYVAL Higher%)
  46.     DECLARE FUNCTION ScrLock% (BYVAL Switch%)
  47.     DECLARE FUNCTION FileSize& (FileSpec$)
  48.     DECLARE FUNCTION StatusLine% (Message$)
  49.     DECLARE FUNCTION StringScan% (Trgt$, BYVAL Size%, BYVAL Strt%, BYVAL Addr%)
  50.     DECLARE FUNCTION Verify% (BYVAL Default%, BYVAL Row%, Prompt$,_
  51.                               BYVAL Attr%, BYVAL Mouse%)
  52.     DECLARE SUB BackFill (BYVAL Row%, BYVAL Col%, BYVAL Rows%, BYVAL Cols%,_
  53.                           BYVAL Attr%)
  54.     DECLARE SUB Cipher (Text$, KeyWord$)
  55.     DECLARE SUB ClearEnd (BYVAL Switch%, BYVAL Attr%)
  56.     DECLARE SUB Curtains (BYVAL Speed%, BYVAL Attr%)
  57.     DECLARE SUB EmsGet (BYVAL Segment%, BYVAL OffSet%, BYVAL Length%,_
  58.                         BYVAL Page%, BYVAL Handle%, Done%)
  59.     DECLARE SUB EmsPut (BYVAL Segment%, BYVAL OffSet%, BYVAL Length%,_
  60.                         BYVAL Page%, BYVAL Handle%, Done%)
  61.     DECLARE SUB EmsRelease (BYVAL Handle%)
  62.     DECLARE SUB EmsRequest (BYVAL Pages%, Handle%)
  63.     DECLARE SUB FastPrint (BYVAL Row%, BYVAL Col%, Message$, BYVAL Attr%)
  64.     DECLARE SUB GraPrint (BYVAL xLoc%, BYVAL yLoc%, Text$, BYVAL Attr%,_
  65.                           BYVAL Scale%)
  66.     DECLARE SUB HelpMate (BYVAL Colour%, Title$, BYVAL Context%, Topic$)
  67.     DECLARE SUB KeyFlush ()
  68.     DECLARE SUB MisTake (BYVAL Row%, Message$, BYVAL Attr%, BYVAL Mouse%)
  69.     DECLARE SUB MouseHide ()
  70.     DECLARE SUB MouseNow (LeftButton%, RightButton%, xMouse%, yMouse%)
  71.     DECLARE SUB MouseShow ()
  72.     DECLARE SUB Pause (BYVAL Ticks%)
  73.     DECLARE SUB PerCentBox (BYVAL Switch%, Message$, BYVAL Attr%,_
  74.                             BYVAL PerCent%)
  75.     DECLARE SUB PopUp (BYVAL Row%, BYVAL Col%, BYVAL Hght%, BYVAL Wdth%,_
  76.                        BYVAL Attr%, BYVAL Brdr%, BYVAL Shdw%, BYVAL Zoom%)
  77.     DECLARE SUB PrintSet (BYVAL Row%, BYVAL Col%, BYVAL Attr%,_
  78.                           BYVAL Printer%, BYVAL Mouse%)
  79.     DECLARE SUB ReSeed (BYVAL Seed&)
  80.     DECLARE SUB Scroll (BYVAL Dir%, BYVAL Y1%, BYVAL X1%, BYVAL Y2%,_
  81.                         BYVAL X2%, BYVAL Units%, BYVAL Attr%)
  82.     DECLARE SUB ShutUp (BYVAL Speed%)
  83.     DECLARE SUB StringSort (BYVAL Dir%, BYVAL Size%, BYVAL Addr%)
  84.     DECLARE SUB VGALoad (File$)
  85.     DECLARE SUB VGAPan (BYVAL X%, BYVAL Y%)
  86.     DECLARE SUB VGASave (File$)
  87.  
  88. '   These are native QuickBASIC procedures which are in MIXED.LIB/QLB
  89. '
  90.     DECLARE FUNCTION BinDec& (Binary$)
  91.     DECLARE FUNCTION BitTest% (Number%, Bit%)
  92.     DECLARE FUNCTION DateInput$ (Default$, Context%, Topic$, HotKey%)
  93.     DECLARE FUNCTION DosVersion$ ()
  94.     DECLARE FUNCTION FindFile$ (FileSpec$, Attr%, Mouse%)
  95.     DECLARE FUNCTION GetFlag% (Flag%)
  96.     DECLARE FUNCTION GrAttrib% (ForeGround%, BackGround%)
  97.     DECLARE FUNCTION IsDir% (Test$)
  98.     DECLARE FUNCTION LongDate$ (Day%, Month%, Year%)
  99.     DECLARE FUNCTION RevInput$ (Max%, Visible%, Default$, Legal$, Ctx%,_
  100.                                 Topic$, Mask%, HotKey%)
  101.     DECLARE SUB BarMenu (P1%, P2%, P3%, Menu$(), P5%, P6%,_
  102.                          P7%, P8$, Mouse%, HotKeys%)
  103.     DECLARE SUB CheckPrinter (Printer%)
  104.     DECLARE SUB Panel (Row%, Col%, Rows%, Cols%, Border%, Attr%)
  105.     DECLARE SUB SetFlag (Flag%, Setting%)
  106.     DECLARE SUB SortFile (PathName$, OffSet%, FieldLen%, RecordLen%, Done%)
  107.     DECLARE SUB VerMenu (P1%, P2%, P3%, P4%, P5%, P6$, Menu$(),_
  108.                          P8%, P9%, P10%, P11%, P12$, Mouse%, HotKeys%)
  109.     DECLARE SUB VideoMode (Colour%, MaxRes%, VideoRam%)
  110.  
  111. '   Local, program-specific, functions and procedures.
  112. '
  113.     DECLARE SUB Frame (Title$, Switch%)
  114.  
  115. '┌────────────────────────────────────────────────────────────────────────┐
  116. '│      Initialisation.                                                   │
  117. '└────────────────────────────────────────────────────────────────────────┘
  118. '
  119.     CONST FALSE = 0, TRUE = NOT FALSE
  120.  
  121. '   Allow plenty of stack space for function and procedure calls.
  122. '
  123.     CLEAR , , &H2000
  124.  
  125. '   Establish error trapping and point to error handler.
  126. '
  127.     ON ERROR GOTO Trap
  128.  
  129. '   Check video capabilities of the host system (default to MDA).
  130. '
  131.     Colour% = FALSE                             ' Default to monochrome
  132.     MaxRes% = 0                                 ' Default to text only
  133.     VideoRam% = 4                               ' Default to 4K buffer
  134.  
  135.     VideoMode Colour%, MaxRes%, VideoRam%       ' Find what's installed
  136.  
  137. '   Set display colours for colour and monochrome displays.
  138. '
  139.     IF Colour% THEN
  140.        BarColour% = 48                          ' Black on Cyan
  141.        HeadColour% = 31                         ' Bright White on Blue
  142.        StatColour% = 48                         ' Black on Cyan
  143.        TextColour% = 112                        ' Black on White
  144.     ELSE
  145.        BarColour% = 112                         ' Reverse video
  146.        HeadColour% = 15                         ' Intense White on Black
  147.        StatColour% = 112                        ' Reverse video
  148.        TextColour% = 7                          ' White on Black
  149.     END IF
  150.  
  151. '   Check the type of display adaptor installed.
  152. '
  153.     SELECT CASE MaxRes%
  154.         CASE 13
  155.              IF VideoRam% = 64 THEN
  156.                 Adaptor$ = "Multi-Colour Graphics Array"
  157.              ELSE
  158.                 Adaptor$ = "Video Graphics Array"
  159.              END IF
  160.         CASE 7 TO 10
  161.              Adaptor$ = "Enhanced Graphics Adaptor"
  162.         CASE 3
  163.              Adaptor$ = "Hercules Graphics Card"
  164.         CASE 2
  165.              Adaptor$ = "Colour Graphics Adaptor"
  166.         CASE ELSE
  167.              Adaptor$ = "Monochrome Display Adaptor"
  168.     END SELECT
  169.  
  170.     Mouse% = MouseInit%                         ' See if a mouse is available
  171.  
  172.     DIM Menu$(0 TO 12)                          ' Dimension array for menus
  173.     HotKeys% = FALSE                            ' Disable hotkeys in menus
  174.     Printer% = 1                                ' Use the first parallel port
  175.     RootName$ = "DEMON"                         ' Used for help topic files
  176.     DOS$ = "DOS " + DosVersion$                 ' Check current DOS version
  177.     Lc$ = "abcdefghijklmnopqrstuvwxyz"          ' Lowercase letters
  178.     Uc$ = UCASE$(Lc$)                           ' Uppercase letters
  179.     Nu$ = "0123456789"                          ' Numerals
  180.     VFln$ = "\._^$~!#%&-@`({})'"                ' Legal pathname characters
  181.  
  182.     DY$ = MID$(DATE$, 4, 2): DY% = VAL(DY$)     ' What day is this?
  183.     MO$ = LEFT$(DATE$, 2): MO% = VAL(MO$)       ' What month is this?
  184.     YR$ = RIGHT$(DATE$, 2): YR% = VAL(YR$)      ' What year is this?
  185.     Now$ = DY$ + "/" + MO$ + "/" + YR$          ' Format it as DD/MM/YY
  186.  
  187.     ToDay$ = LongDate$(DY%, MO%, YR%)           ' Translate date into words
  188.  
  189. '┌────────────────────────────────────────────────────────────────────────┐
  190. '│      Main Menu.                                                        │
  191. '└────────────────────────────────────────────────────────────────────────┘
  192. '
  193.     ReSeed TIMER
  194. D001:
  195.     Head$ = "ASSEMBLY-LANGUAGE TOOLBOX FOR QuickBASIC"
  196.     LOCATE , , 0: Frame Head$, 1: Bar% = 1
  197. D002:
  198.     IF MaxRes% < 1 THEN
  199.        Menu$(0) = "WSFKME X"
  200.     ELSE
  201.        Menu$(0) = "WSFKMEGX"
  202.     END IF
  203.     Menu$(1) = "&Windows": Menu$(2) = "&Screen"
  204.     Menu$(3) = "&Files": Menu$(4) = "&Keyboard"
  205.     Menu$(5) = "&Memory": Menu$(6) = "&Examples"
  206.     Menu$(7) = "&Graphics": Menu$(8) = "E&xit"
  207.     Abort% = FALSE: HotKey% = FALSE
  208.     IF Nxt% THEN
  209.        IF Bar% = 1 THEN Bar% = 8
  210.        IF Bar% = 9 THEN Bar% = 2
  211.     END IF
  212.     BarMenu 3, BarColour%, 8, Menu$(), Bar%, Nxt%, 1,_
  213.             RootName$, Mouse%, HotKeys%
  214.     SELECT CASE Bar%
  215.         CASE 1
  216.              GOTO D100
  217.         CASE 2
  218.              GOTO D200
  219.         CASE 3
  220.              GOTO D300
  221.         CASE 4
  222.              GOTO D400
  223.         CASE 5
  224.              GOTO D500
  225.         CASE 6
  226.              GOTO D600
  227.         CASE 7
  228.              GOTO D700
  229.         CASE 8
  230.              GOTO D800
  231.         CASE 9
  232.              HelpMate 0, "", 0, ""
  233.         CASE ELSE
  234.              Ok% = Verify%(1, 9, "Exit program, are you sure", 0, Mouse%)
  235.              IF Ok% THEN GOTO Egress
  236.     END SELECT
  237. GOTO D002
  238.  
  239. '┌────────────────────────────────────────────────────────────────────────┐
  240. '│      Popup Window Demonstration.                                       │
  241. '└────────────────────────────────────────────────────────────────────────┘
  242. '
  243. D100:
  244.     A$ = STRING$(1680, "░"): FastPrint 4, 1, A$, 30
  245.     FastPrint 25, 1, SPACE$(80), StatColour%: A$ = ""
  246.     FastPrint 25, 2, Adaptor$, StatColour%
  247.     FastPrint 25, 71, DOS$, StatColour%
  248.     FOR M% = 1 TO 3
  249.         Area% = 0: O% = 0: B% = 1
  250.         DO
  251.             H% = Rand%(5, 10): W% = Rand%(14, 40)
  252.             Area% = Area% + (H% + 1) * (W% + 1)
  253.             IF Area% > 7200 THEN EXIT DO
  254.             K% = Rand%(4, 24 - H%): J% = Rand%(1, 79 - W%)
  255.             R% = Rand%(1, 4): S% = Rand%(1, 4)
  256.             Attrib% = Attribute%(15, B%)
  257.             PopUp K%, J%, H%, W%, Attrib%, R%, S%, -1
  258.             FastPrint K%, J% + ((W% \ 2) - 5), "[ WINDOW ]", Attrib%
  259.             O% = O% + 1: B% = B% + 1: IF B% > 6 THEN B% = 1
  260.          LOOP UNTIL O% = 30
  261.          IF (M% = 3) THEN SLEEP 3 ELSE SLEEP 1
  262.          FOR I% = O% TO 1 STEP -1
  263.              ShutUp -1
  264.          NEXT I%
  265.     NEXT M%
  266.     PopUp 4, 15, 10, 30, 52, 4, 1, -1: PopUp 3, 36, 13, 40, 47, 3, 1, -1
  267.     PopUp 9, 10, 13, 40, 31, 2, 1, -1: PopUp 12, 42, 11, 36, 67, 1, 1, -1
  268.     PopUp 2, 31, 5, 20, 78, 2, 1, -1: FastPrint 4, 34, "Presenting ...", 78
  269.     SLEEP 3: KeyFlush: Attrib% = Attribute%(0, 7)
  270.     PopUp 8, 20, 7, 40, Attrib%, 2, 1, -1
  271.     FastPrint 8, 31, "[ QUICK  WINDOWS ]", Attrib%
  272.     FastPrint 10, 29, "Windowing Routines for", Attrib%
  273.     FastPrint 11, 30, "Microsoft QuickBASIC", Attrib%
  274.     SLEEP 3: KeyFlush: Attrib% = Attribute%(0, 3)
  275.     PopUp 17, 55, 7, 24, Attrib%, 1, 3, -1
  276.     FastPrint 19, 66, "By", Attrib%
  277.     FastPrint 20, 59, "Christy  Gemmell", Attrib%
  278.     FastPrint 21, 57, "with acknowledgement", Attrib%
  279.     FastPrint 22, 58, "to Rick Fothergill", Attrib%
  280.     SLEEP 3: KeyFlush: Attrib% = Attribute%(14, 1)
  281.     PopUp 13, 2, 10, 23, Attrib%, 2, 4, 0
  282.     FastPrint 15, 4, "A Library of screen", Attrib%
  283.     FastPrint 16, 4, "handling procedures", Attrib%
  284.     FastPrint 17, 4, "and functions which", Attrib%
  285.     FastPrint 18, 4, "can be incorporated", Attrib%
  286.     FastPrint 19, 4, "in your QuickBASIC", Attrib%
  287.     FastPrint 20, 9, "programs.", Attrib%
  288.     SLEEP 4: KeyFlush: Attrib% = Attribute%(15, 1)
  289.     PopUp 16, 27, 5, 26, Attrib%, 2, 1, 0
  290.     FastPrint 18, 30, "HOLD ONTO YOUR HATS", Attrib%
  291.     SLEEP 2: KeyFlush: FOR I% = 1 TO 9: ShutUp -1: NEXT
  292.     Attrib% = 112: PopUp 9, 16, 8, 50, Attrib%, 2, 2, 0: RESTORE Blurb
  293.     FOR I% = 10 TO 15: READ Me$: FastPrint I%, 19, Me$, Attrib%: NEXT
  294.     SLEEP 6: KeyFlush: Scroll 1, 10, 17, 15, 64, 0, Attrib%
  295.     FOR I% = 12 TO 13: READ Me$: FastPrint I%, 19, Me$, Attrib%: NEXT
  296.     SLEEP 5: KeyFlush: IF Colour% THEN Attrib% = Attribute%(1, 2)
  297.     PopUp 5, 5, 6, 35, Attrib%, 0, 1, -1
  298.     SLEEP 3: ShutUp -1: Scroll 1, 10, 17, 15, 64, 0, 112
  299.     FOR I% = 12 TO 13: READ Me$: FastPrint I%, 19, Me$, 112: NEXT
  300.     SLEEP 6: KeyFlush: IF Colour% THEN Attrib% = Attribute%(15, 6)
  301.     PopUp 6, 5, 8, 35, Attrib%, 0, 2, -1
  302.     FastPrint 6, 15, "[  No  Frame  ]", Attrib%
  303.     SLEEP 1: KeyFlush: IF Colour% THEN Attrib% = Attribute%(11, 1)
  304.     PopUp 7, 8, 8, 35, Attrib%, 1, 2, -1
  305.     FastPrint 7, 17, "[ Frame Style 1 ]", Attrib%
  306.     SLEEP 1: KeyFlush: IF Colour% THEN Attrib% = Attribute%(0, 2)
  307.     PopUp 8, 11, 8, 35, Attrib%, 2, 2, -1
  308.     FastPrint 8, 20, "[ Frame Style 2 ]", Attrib%
  309.     SLEEP 1: KeyFlush: IF Colour% THEN Attrib% = Attribute%(0, 3)
  310.     PopUp 9, 14, 8, 35, Attrib%, 3, 2, -1
  311.     FastPrint 9, 23, "[ Frame Style 3 ]", Attrib%
  312.     SLEEP 1: KeyFlush: IF Colour% THEN Attrib% = Attribute%(14, 4)
  313.     PopUp 10, 17, 8, 35, Attrib%, 4, 2, -1
  314.     FastPrint 10, 26, "[ Frame Style 4 ]", Attrib%
  315.     SLEEP 1: KeyFlush: IF Colour% THEN Attrib% = Attribute%(12, 5)
  316.     PopUp 11, 20, 8, 35, Attrib%, 5, 2, -1
  317.     FastPrint 11, 29, "[ Frame Style 5 ]", Attrib%
  318.     SLEEP 1: KeyFlush: IF Colour% THEN Attrib% = Attribute%(13, 6)
  319.     PopUp 12, 23, 8, 35, Attrib%, 6, 2, -1
  320.     FastPrint 12, 32, "[ Frame Style 6 ]", Attrib%
  321.     SLEEP 1: KeyFlush: IF Colour% THEN Attrib% = Attribute%(15, 2)
  322.     PopUp 13, 26, 8, 35, Attrib%, 7, 2, -1
  323.     FastPrint 13, 35, "[ Frame Style 7 ]", Attrib%
  324.     SLEEP 1: KeyFlush: IF Colour% THEN Attrib% = Attribute%(1, 3)
  325.     PopUp 14, 29, 8, 35, Attrib%, 8, 2, -1
  326.     FastPrint 14, 39, "[ Frame Style 8 ]", Attrib%
  327.     SLEEP 4: KeyFlush: FOR I% = 1 TO 9: ShutUp -1: NEXT
  328.     Scroll 1, 10, 17, 15, 64, 0, 112
  329.     FOR I% = 11 TO 13: READ Me$: FastPrint I%, 20, Me$, 112: NEXT
  330.     SLEEP 6: KeyFlush
  331.     FOR I% = 1 TO 15
  332.         Label$ = "[ Colour:" + STR$(I%) + " ]"
  333.         J% = Rand%(1, 51): K% = Rand%(1, 13)
  334.         Attrib% = Attribute%(I%, 0)
  335.         PopUp K% + 1, J% + 1, 7, 24, Attrib%, 4, 0, 0
  336.         FastPrint K% + 1, J% + 6, Label$, Attrib%
  337.         SLEEP 1: KeyFlush
  338.     NEXT I%
  339.     Attrib% = Attribute%(31, B%)
  340.     PopUp 7, 20, 7, 24, Attrib%, 4, 2, 0
  341.     FastPrint 7, 25, "[ Colour: 31 ]", Attrib%
  342.     SLEEP 4: KeyFlush: FOR I% = 1 TO 16: ShutUp 0: NEXT
  343.     Scroll 1, 10, 17, 15, 64, 0, 112
  344.     FOR I% = 12 TO 13: READ Me$: FastPrint I%, 19, Me$, 112: NEXT
  345.     SLEEP 6: KeyFlush: Attrib% = Attribute%(15, 1)
  346.     PopUp 2, 2, 11, 30, Attrib%, 7, 0, 0
  347.     SLEEP 3: KeyFlush: ShutUp 0: Scroll 1, 10, 17, 15, 64, 0, 112
  348.     FOR I% = 12 TO 13: READ Me$: FastPrint I%, 19, Me$, 112: NEXT
  349.     SLEEP 6: KeyFlush: Attrib% = Attribute%(14, 5)
  350.     PopUp 5, 5, 10, 30, Attrib%, 2, 1, 0
  351.     FastPrint 9, 14, "Left Shadow", Attrib%
  352.     SLEEP 2: KeyFlush: Attrib% = Attribute%(0, 2)
  353.     PopUp 5, 45, 10, 30, Attrib%, 2, 2, 0
  354.     FastPrint 9, 54, "Right Shadow", Attrib%
  355.     SLEEP 2: KeyFlush: ShutUp 0: ShutUp 0
  356.     Scroll 1, 10, 17, 15, 64, 0, 112
  357.     FastPrint 12, 31, "Windows can be zoomed", 112
  358.     FastPrint 13, 33, "onto the screen.", 112
  359.     SLEEP 3: KeyFlush: Attrib% = Attribute%(0, 2)
  360.     PopUp 2, 2, 15, 60, Attrib%, 2, 0, -1
  361.     SLEEP 2: KeyFlush: Attrib% = Attribute%(0, 3)
  362.     PopUp 13, 10, 10, 60, Attrib%, 3, 0, -1
  363.     SLEEP 2: KeyFlush: Attrib% = Attribute%(14, 5)
  364.     PopUp 7, 33, 10, 45, Attrib%, 1, 0, -1
  365.     SLEEP 2: KeyFlush: Attrib% = Attribute%(15, 4)
  366.     IF NOT Colour% THEN Attrib% = 112
  367.     PopUp 7, 10, 12, 63, Attrib%, 2, 1, -1
  368.     FastPrint 12, 32, "<<< W O W >>>", Attrib%
  369.     SLEEP 3: KeyFlush: FOR I% = 1 TO 4: ShutUp -1: NEXT
  370.     Scroll 1, 10, 17, 15, 64, 0, 112
  371.     FOR I% = 10 TO 14: READ Me$: FastPrint I%, 19, Me$, 112: NEXT
  372.     SLEEP 6: KeyFlush: Scroll 1, 10, 17, 15, 64, 0, 112
  373.     FOR I% = 10 TO 15: READ Me$: FastPrint I%, 19, Me$, 112: NEXT
  374.     SLEEP 6: KeyFlush: Scroll 1, 10, 17, 15, 64, 0, 112
  375.     FOR I% = 10 TO 15: READ Me$: FastPrint I%, 19, Me$, 112: NEXT
  376.     SLEEP 6: KeyFlush: Attrib% = Attribute%(0, 2)
  377.     PopUp 3, 5, 15, 45, Attrib%, 4, 1, -1
  378.     FastPrint 9, 14, "This is the first level ...", Attrib%
  379.     SLEEP 2: KeyFlush: Attrib% = Attribute%(15, 4)
  380.     PopUp 6, 29, 17, 50, Attrib%, 4, 1, -1
  381.     FastPrint 12, 40, "This is the second level ...", Attrib%
  382.     SLEEP 2: KeyFlush: Attrib% = Attribute%(0, 3)
  383.     PopUp 9, 22, 15, 35, Attrib%, 4, 1, -1
  384.     FastPrint 16, 26, "This is the third level ...", Attrib%
  385.     SLEEP 2: KeyFlush: FastPrint 16, 26, "Now to go back ...         ", Attrib%
  386.     SLEEP 1: ShutUp -1: SLEEP 1: ShutUp -1: SLEEP 1: ShutUp -1: SLEEP 2
  387.     Scroll 1, 10, 17, 15, 64, 0, 112: KeyFlush
  388.     FOR I% = 10 TO 15: READ Me$: FastPrint I%, 19, Me$, 112: NEXT
  389.     Ok% = Verify%(1, 9, "Are you enjoying this program", 0, Mouse%)
  390.     Scroll 1, 10, 17, 15, 64, 0, 112
  391.     IF Ok% THEN
  392.        FastPrint 11, 28, "You sound very positive!", 112
  393.     ELSE
  394.        FastPrint 11, 28, "You sound very negative!", 112
  395.     END IF
  396.     SLEEP 2: KeyFlush: Scroll 1, 10, 17, 15, 64, 0, 112
  397.     FOR I% = 10 TO 15: READ Me$: FastPrint I%, 19, Me$, 112: NEXT
  398.     SLEEP 3: KeyFlush: SL% = StatusLine%("Want to carry on?")
  399.     IF SL% = 78 OR SL% = 110 OR SL% = 27 THEN
  400.        ShutUp -1
  401.     ELSE
  402.        A$ = STRING$(44, SL%)
  403.        FOR I% = 10 TO 15: FastPrint I%, 19, A$, 112: NEXT
  404.        SLEEP 6: KeyFlush: Scroll 1, 10, 17, 15, 64, 0, 112
  405.        FOR I% = 10 TO 15: READ Me$: FastPrint I%, 19, Me$, 112: NEXT
  406.        SLEEP 6: KeyFlush: Scroll 1, 10, 17, 15, 64, 0, 112
  407.        Ready% = PrinTest%(Printer%)
  408.        IF Ready% THEN
  409.           FastPrint 11, 30, "PRINTER CONTROL MENU", 112
  410.           FastPrint 13, 24, "The Toolbox contains versions for", 112
  411.           FastPrint 14, 27, "two other popular printers.", 112
  412.           FastPrint 25, 2, "Press <ESC> to Abort       ", StatColour%
  413.           PrintSet 4, 51, 0, Printer%, Mouse%
  414.           FastPrint 25, 1, SPACE$(80), StatColour%
  415.           FastPrint 25, 2, Adaptor$, StatColour%
  416.           FastPrint 25, 71, DOS$, StatColour%
  417.           SLEEP 5: KeyFlush
  418.        END IF
  419.        ShutUp -1
  420.        PopUp 4, 15, 10, 30, 52, 4, 1, -1
  421.        PopUp 3, 36, 13, 40, 47, 3, 1, -1
  422.        PopUp 9, 10, 13, 40, 78, 2, 1, -1
  423.        PopUp 12, 42, 11, 36, 67, 1, 1, -1
  424.        PopUp 9, 16, 8, 52, 112, 2, 1, -1
  425.        FastPrint 11, 20, "The video routines in the Toolbox Library", 112
  426.        FastPrint 12, 20, "give you all you need to create powerful", 112
  427.        FastPrint 13, 20, "and professional screen displays in your", 112
  428.        FastPrint 14, 20, "QuickBASIC programs.", 112: SLEEP 9: KeyFlush
  429.        FOR I% = 1 TO 5: ShutUp -1: SLEEP 1: KeyFlush: NEXT
  430.        IF NOT Ready% THEN
  431.           PopUp 10, 18, 5, 44, 96, 1, 2, 0
  432.           Me$ = "Pity you didn't have a printer connected"
  433.           FastPrint 12, 20, Me$, 96: SLEEP 5: KeyFlush: ShutUp 0
  434.        END IF
  435.     END IF
  436. GOTO D001
  437.  
  438. '┌────────────────────────────────────────────────────────────────────────┐
  439. '│      Screen control functions.                                         │
  440. '└────────────────────────────────────────────────────────────────────────┘
  441. '
  442. D200:
  443.     Menu$(0) = "F#SC#B"
  444.     Menu$(1) = "&Fast screen printing"
  445.     Menu$(3) = "&Selective scrolling"
  446.     Menu$(4) = "&Clear to the end"
  447.     Menu$(6) = "&Background colours"
  448.     VerMenu 4, 3, BarColour%, 1, 6, "SCREEN CONTROL", Menu$(),_
  449.             Choice%, Nxt%, Bar%, 1, RootName$, Mouse%, HotKeys%
  450.     IF Nxt% THEN GOTO D002
  451.     SELECT CASE Choice%
  452.         CASE 1
  453.              GOTO D210
  454.         CASE 3
  455.              GOTO D220
  456.         CASE 4
  457.              GOTO D230
  458.         CASE 6
  459.              GOTO D240
  460.         CASE ELSE
  461.     END SELECT
  462. GOTO D002
  463.  
  464. '   Screen print demonstration
  465. '
  466. D210:
  467.     A$ = STRING$(1680, "«"): B$ = STRING$(1680, "»")
  468.     FOR I% = 1 TO 255
  469.         FastPrint 4, 1, A$, I%: FastPrint 4, 1, B$, I%
  470.         IF INKEY$ = CHR$(27) THEN EXIT FOR
  471.     NEXT I%
  472.     IF I% = 256 THEN
  473.        A$ = "": B$ = "": C$ = STRING$(1680, "░"): Attrib% = 30
  474.        FastPrint 4, 1, C$, Attrib%: C$ = ""
  475.        IF Colour% THEN Attrib% = 48 ELSE Attrib% = 112
  476.        PopUp 12, 21, 7, 40, Attrib%, 3, 4, -1
  477.        FastPrint 15, 33, "<<< W O W >>>", Attrib%
  478.        SLEEP 5: KeyFlush: ShutUp -1
  479.     END IF
  480. GOTO D200
  481.  
  482. '   Selective scrolling demonstration
  483. '
  484. D220:
  485.     Panel 4, 1, 21, 80, 1, TextColour%
  486.     IF Colour% THEN BackGround% = 7 ELSE BackGround% = 0
  487.     Clr% = 1: IF Mouse% THEN MouseShow
  488.     DO
  489.        Scroll 0, 4, 21, 7, 60, 1, Attribute%(0, Clr%)
  490.        Scroll 2, 9, 6, 19, 20, 1, Attribute%(0, Clr%)
  491.        Scroll 3, 9, 61, 19, 75, 1, Attribute%(0, Clr%)
  492.        Scroll 1, 21, 21, 24, 60, 1, Attribute%(0, Clr%)
  493.        COLOR Clr%, BackGround%
  494.        LOCATE 19, 25: PRINT "SCROLLING UP";
  495.        Scroll 0, 9, 23, 19, 38, 1, Attribute%(Clr%, BackGround%)
  496.        LOCATE 9, 43: PRINT "SCROLLING DOWN";
  497.        Scroll 1, 9, 41, 19, 58, 1, Attribute%(Clr%, BackGround%)
  498.        Pause 1: Clr% = Clr% + 1
  499.        IF Clr% = BackGround% THEN Clr% = Clr% + 1
  500.        IF Clr% > 7 THEN Clr% = 1
  501.        IF Mouse% THEN
  502.           MouseNow LeftButton%, RightButton%, xMouse%, yMouse%
  503.           IF LeftButton% THEN
  504.              IF yMouse% > 15 AND yMouse% < 24 THEN
  505.                 Z$ = CHR$(32): EXIT DO
  506.              END IF
  507.           END IF
  508.        END IF
  509.        Z$ = INKEY$
  510.     LOOP UNTIL Z$ = CHR$(27)
  511.     IF Mouse% THEN
  512.        CALL MouseHide: IF Z$ <> CHR$(27) THEN GOTO D002
  513.     END IF
  514. GOTO D200
  515.  
  516. '   Clear to end of line or screen
  517. '
  518. D230:
  519.     Panel 4, 1, 24, 80, 1, TextColour%
  520.     IF Colour% THEN Attrib% = 15 ELSE Attrib% = 112
  521.     FastPrint 22, 30, "Press a key to do it", TextColour%
  522.     FastPrint 10, 3, "Clear end of line >", TextColour%
  523.     LOCATE 10, 22, 1: R$ = INPUT$(1): ClearEnd 0, Attrib%
  524.     FastPrint 15, 3, "Clear end of screen >", TextColour%
  525.     LOCATE 15, 24, 1: R$ = INPUT$(1): ClearEnd 1, Attrib%
  526.     LOCATE , , 0: Frame Head$, 0
  527. GOTO D200
  528.  
  529. D240:
  530.     FastPrint 25, 1, SPACE$(80), StatColour%
  531.     FastPrint 25, 3, "Press any key, <Esc> to abort", StatColour%
  532.     RANDOMIZE TIMER: IF Mouse% THEN MouseShow
  533.     DO
  534.        Row% = Rand%(5, 20): Col% = Rand%(2, 62): Rows% = Rand%(1, 16)
  535.        IF Row% + Rows% > 23 THEN Rows% = 24 - Row%
  536.        Cols% = Rand%(1, 60): IF Col% + Cols% > 78 THEN Cols% = 79 - Col%
  537.        Attrib% = Rand%(0, 255): BackFill Row%, Col%, Rows%, Cols%, Attrib%
  538.        DO
  539.           IF Mouse% THEN
  540.              MouseNow LeftButton%, RightButton%, xMouse%, yMouse%
  541.              IF LeftButton% THEN
  542.                 IF yMouse% > 15 AND yMouse% < 24 THEN
  543.                    Z$ = CHR$(27)
  544.                    EXIT DO
  545.                 ELSE
  546.                    Z$ = CHR$(32)
  547.                    EXIT DO
  548.                 END IF
  549.              END IF
  550.           END IF
  551.           Z$ = INKEY$
  552.        LOOP UNTIL Z$ <> ""
  553.     LOOP UNTIL Z$ = CHR$(27)
  554.     Frame Head$, 0: IF Mouse% THEN MouseHide:
  555.     IF Z$ <> CHR$(27) THEN GOTO D002
  556. GOTO D200
  557.  
  558. '┌────────────────────────────────────────────────────────────────────────┐
  559. '│      File Functions.                                                   │
  560. '└────────────────────────────────────────────────────────────────────────┘
  561. '
  562. D300:
  563.     Menu$(0) = "WH#S"
  564.     Menu$(1) = "&Where's that file?"
  565.     Menu$(2) = "&How big is that file?"
  566.     Menu$(4) = "&Sort that file"
  567.     Abort% = FALSE
  568.     VerMenu 4, 9, BarColour%, 1, 4, "FILE FUNCTIONS", Menu$(),_
  569.             Choice%, Nxt%, Bar%, 1, RootName$, Mouse%, HotKeys%
  570.     IF Nxt% THEN GOTO D002
  571.     SELECT CASE Choice%
  572.         CASE 1
  573.              GOTO D310
  574.         CASE 2
  575.              GOTO D320
  576.         CASE 4
  577.              GOTO D330
  578.         CASE ELSE
  579.     END SELECT
  580. GOTO D002
  581.  
  582. '   File Finder
  583. '
  584. D310:
  585.     Panel 4, 1, 21, 80, 1, TextColour%
  586.     RESTORE Finder
  587.     FOR I% = 1 TO 13
  588.         READ Me$: FastPrint 5 + I%, 14, Me$, TextColour%
  589.     NEXT I%
  590.     Scroll 1, 19, 2, 21, 79, 0, TextColour%
  591.     PopUp 19, 19, 4, 44, 96, 2, 2, -1: HotKey% = FALSE
  592.     FastPrint 20, 28, "Enter name of file to find", 96
  593.     LOCATE 21, 21: Legal$ = Uc$ + Lc$ + Nu$ + VFln$ + ":*?"
  594.     PathName$ = RevInput$(40, 0, "", Legal$, 1, "REVINPUT", 0, HotKey%)
  595.     ShutUp -1
  596.     IF HotKey% THEN
  597.        Abort% = TRUE
  598.     ELSE
  599.        PathName$ = RTRIM$(LTRIM$(PathName$))
  600.        Found$ = FindFile$(PathName$, 0, Mouse%)
  601.        IF Found$ <> "" THEN
  602.           Found$ = LTRIM$(RTRIM$(Found$))
  603.           OT% = 40 - (LEN(Found$) \ 2)
  604.           FastPrint 20, OT%, Found$, TextColour%
  605.        END IF
  606.     END IF
  607. GOTO D300
  608.  
  609. D320:
  610.     Panel 4, 1, 21, 80, 1, TextColour%
  611.     RESTORE Size
  612.     FOR I% = 1 TO 12
  613.         READ Me$: FastPrint 5 + I%, 8, Me$, TextColour%
  614.     NEXT I%
  615.     Scroll 1, 18, 3, 23, 78, 0, TextColour%: HotKey% = FALSE
  616.     LOCATE 20, 20: Legal$ = Uc$ + Lc$ + Nu$ + VFln$ + "*?"
  617.     PathName$ = RevInput$(64, 40, "", Legal$, 1, "REVINPUT", 0, HotKey%)
  618.     IF HotKey% THEN
  619.        Abort% = TRUE
  620.     ELSE
  621.        PathName$ = LTRIM$(RTRIM$(PathName$))
  622.        IF PathName$ = "" THEN PathName$ = "*.*"
  623.        IF IsDir%(PathName$) THEN PathName$ = PathName$ + "\*.*"
  624.        FastPrint 20, 8, SPACE$(64), TextColour%
  625.        FastPrint 20, 8, PathName$, TextColour%
  626.        Bytes& = FileSize&(PathName$)
  627.        IF Bytes& > 0 THEN
  628.           Me$ = "Size = " + LTRIM$(RTRIM$(STR$(Bytes&))) + " bytes"
  629.           FastPrint 22, 40 - (LEN(Me$) \ 2), Me$, TextColour%
  630.        ELSE
  631.           MisTake 9, "No match found!", 0, Mouse%
  632.        END IF
  633.     END IF
  634. GOTO D300
  635.  
  636. '   File sorter.
  637. '
  638. D330:
  639.     Panel 4, 1, 21, 80, 1, TextColour%
  640.     RESTORE Sorts
  641.     FOR I% = 1 TO 10
  642.         READ Me$: FastPrint 4 + I%, 8, Me$, TextColour%
  643.     NEXT I%
  644.     IF FileSize&("SAMPLE.DAT") < 1 THEN
  645.        MisTake 9, "Can't find SAMPLE data file to sort!", 0, Mouse%
  646.     ELSE
  647.        IF Colour% THEN Attrib% = 32 ELSE Attrib% = 112
  648.        PopUp 16, 3, 8, 74, Attrib%, 1, 4, -1
  649.        FastPrint 16, 36, " SAMPLE.DAT ", Attrib%
  650.        OPEN "SAMPLE.DAT" FOR INPUT AS #1
  651.        FOR I% = 1 TO 6
  652.            LINE INPUT #1, A$: OL% = LEN(A$)
  653.            Me$ = LEFT$(A$, OL% - 2)
  654.            FastPrint 16 + I%, 40 - (OL% \ 2) + 1, Me$, Attrib%
  655.        NEXT I%
  656.        CLOSE 1: SL% = StatusLine%("To begin sorting ...")
  657.        SortFile "SAMPLE.DAT", 1, 10, OL% + 2, Done%
  658.        IF Done% THEN
  659.           OPEN "SAMPLE.DAT" FOR INPUT AS #1
  660.           FOR I% = 1 TO 6
  661.               LINE INPUT #1, A$: OL% = LEN(A$)
  662.               Me$ = LEFT$(A$, OL% - 2)
  663.               FastPrint 16 + I%, 40 - (OL% \ 2) + 1, Me$, Attrib%
  664.           NEXT I%
  665.           CLOSE 1
  666.           SL% = StatusLine%("File successfully sorted"): ShutUp -1
  667.        ELSE
  668.           ShutUp -1
  669.           FastPrint 21, 30, "Unable to sort file", TextColour%
  670.        END IF
  671.     END IF
  672. GOTO D300
  673.  
  674. '┌────────────────────────────────────────────────────────────────────────┐
  675. '│      Keyboard functions and procedures.                                │
  676. '└────────────────────────────────────────────────────────────────────────┘
  677. '
  678. D400:
  679.     Menu$(0) = "AKT#M"
  680.     Menu$(1) = "&ASCII and scan codes"
  681.     Menu$(2) = "&Keyboard shift flags"
  682.     Menu$(3) = "&Typeahead buffer"
  683.     Menu$(5) = "&Mouse position and status"
  684.     VerMenu 4, 16, BarColour%, 1, 5, "KEYBOARD AND MOUSE", Menu$(),_
  685.             Choice%, Nxt%, Bar%, 1, RootName$, Mouse%, HotKeys%
  686.     IF Nxt% THEN GOTO D002
  687.     SELECT CASE Choice%
  688.         CASE 1
  689.              GOTO D410
  690.         CASE 2
  691.              GOTO D420
  692.         CASE 3
  693.              GOTO D430
  694.         CASE 5
  695.              GOTO D440
  696.         CASE ELSE
  697.     END SELECT
  698. GOTO D002
  699.  
  700. '   Indexes to the font table in ROM-BIOS, then translates the pixel
  701. '   values of the character specified by a keypress, into a large-
  702. '   scale representation of that character.
  703. '
  704. D410:
  705.     Panel 4, 1, 21, 80, 1, TextColour%
  706.     Fore$ = STRING$(2, "█"): Back$ = STRING$(2, "░")
  707.     FastPrint 6, 31, "┌────────────────┐", TextColour%
  708.     FOR Row% = 7 TO 14
  709.         FastPrint Row%, 31, "│" + STRING$(16, "░") + "│", TextColour%
  710.     NEXT Row%
  711.     FastPrint 15, 31, "└────────────────┘", TextColour%
  712.     FastPrint 25, 1, SPACE$(80), StatColour%
  713.     FastPrint 25, 3, "Press any key, or <Esc> to abort", StatColour%
  714.     LOCATE 21, 40, 1: Abort% = FALSE: CALL KeyFlush
  715.     DO
  716.         Character% = KeyIn%: IF Character% = 27 THEN EXIT DO
  717.         FastPrint 21, 40, " ", TextColour%
  718.         FastPrint 16, 10, SPACE$(60), TextColour%
  719.         SELECT CASE Character%
  720.             CASE 0 TO 127
  721.                  FOR Row% = 1 TO 8
  722.                      Pixel% = FarPeek%(&HF000, &HFA6D + (Character% * 8)_
  723.                                        + Row%)
  724.                      IF Pixel% = 0 THEN
  725.                         FastPrint Row% + 6, 32, STRING$(16, "░"), TextColour%
  726.                      ELSE
  727.                         Col% = 32
  728.                         FOR Column% = 7 TO 0 STEP -1
  729.                             IF Pixel% < 2 ^ Column% THEN
  730.                                FastPrint Row% + 6, Col%, Back$, TextColour%
  731.                             ELSE
  732.                                FastPrint Row% + 6, Col%, Fore$, TextColour%
  733.                                Pixel% = Pixel% - 2 ^ Column%
  734.                             END IF
  735.                             Col% = Col% + 2
  736.                         NEXT Column%
  737.                      END IF
  738.                  NEXT Row%
  739.             CASE ELSE
  740.                  IF Character% < 0 THEN
  741.                     Me$ = SPACE$(16)
  742.                  ELSE
  743.                     Me$ = STRING$(16, Character%)
  744.                  END IF
  745.                  FOR Row% = 1 TO 8
  746.                      FastPrint Row% + 6, 32, Me$, TextColour%
  747.                  NEXT Row%
  748.         END SELECT
  749.         IF Character% < 0 THEN
  750.            Me$ = "Scan Code " + LTRIM$(RTRIM$(STR$(ABS(Character%))))
  751.         ELSE
  752.            Me$ = "ASCII Code " + LTRIM$(RTRIM$(STR$(Character%)))
  753.         END IF
  754.         FastPrint 16, 40 - (LEN(Me$) \ 2), Me$, TextColour%
  755.     LOOP WHILE 1
  756.     LOCATE , , 0: Frame Head$, 0
  757. GOTO D400
  758.  
  759. '   Keyboard shift flags.
  760. '
  761. D420:
  762.     Panel 4, 1, 21, 80, 1, TextColour%
  763.     ShiftFlags% = KeyFlags%: Flag$ = STRING$(16, "0")
  764.     FOR I% = 15 TO 0 STEP -1
  765.         IF BitTest%(ShiftFlags%, I%) THEN
  766.            MID$(Flag$, 16 - I%, 1) = "1"
  767.         END IF
  768.     NEXT I%
  769.     FastPrint 5, 40, "Keyboard Status Word at 0040:0017", TextColour%
  770.     FastPrint 7, 40, "Bit settings (1 = set)", TextColour%
  771.     FastPrint 5, 3, " F E D C B A 9 8 7 6 5 4 3 2 1 0", TextColour%
  772.     FastPrint 6, 3, "┌─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┐", TextColour%
  773.     FastPrint 7, 3, "│", TextColour%: Col% = 4
  774.     FOR I% = 1 TO 16
  775.         FastPrint 7, Col%, MID$(Flag$, I%, 1) + "│", TextColour%
  776.         Col% = Col% + 2
  777.     NEXT I%
  778.     FastPrint 8, 3, "└─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┘", TextColour%
  779.     FastPrint 9, 3, " │ │ │ │ │ │ │ │ │ │ │ │ │ │ └─┴─", TextColour%
  780.     FastPrint 10, 3, " │ │ │ │ │ │ │ │ │ │ │ │ │ └─────", TextColour%
  781.     FastPrint 11, 3, " │ │ │ │ │ │ │ │ │ │ │ │ └───────", TextColour%
  782.     FastPrint 12, 3, " │ │ │ │ │ │ │ │ │ │ │ └─────────", TextColour%
  783.     FastPrint 13, 3, " │ │ │ │ │ │ │ │ │ │ └───────────", TextColour%
  784.     FastPrint 14, 3, " │ │ │ │ │ │ │ │ │ └─────────────", TextColour%
  785.     FastPrint 15, 3, " │ │ │ │ │ │ │ │ └───────────────", TextColour%
  786.     FastPrint 16, 3, " │ │ │ │ │ │ │ └─────────────────", TextColour%
  787.     FastPrint 17, 3, " │ │ │ │ │ │ └───────────────────", TextColour%
  788.     FastPrint 18, 3, " │ │ │ │ │ └─────────────────────", TextColour%
  789.     FastPrint 19, 3, " │ │ │ │ └───────────────────────", TextColour%
  790.     FastPrint 20, 3, " │ │ │ └─────────────────────────", TextColour%
  791.     FastPrint 21, 3, " │ │ └───────────────────────────", TextColour%
  792.     FastPrint 22, 3, " │ └─────────────────────────────", TextColour%
  793.     FastPrint 23, 3, " └───────────────────────────────", TextColour%
  794.     FastPrint 25, 1, SPACE$(80), StatColour%
  795.     FastPrint 25, 3, "Press <Esc> to abort", StatColour%
  796.     RESTORE Shift
  797.     FOR I% = 1 TO 15
  798.         READ Me$: FastPrint I% + 8, 40, Me$, TextColour%
  799.     NEXT I%
  800.     IF Mouse% THEN MouseShow
  801.     DO
  802.         ShiftFlags% = KeyFlags%
  803.         FOR I% = 15 TO 0 STEP -1
  804.             IF BitTest%(ShiftFlags%, I%) THEN
  805.                MID$(Flag$, 16 - I%, 1) = "1"
  806.             ELSE
  807.                MID$(Flag$, 16 - I%, 1) = "0"
  808.             END IF
  809.         NEXT I%
  810.         Col% = 4
  811.         FOR I% = 1 TO 16
  812.             FastPrint 7, Col%, MID$(Flag$, I%, 1) + "│", TextColour%
  813.             Col% = Col% + 2
  814.         NEXT I%
  815.         CL% = CapsLock%(2)
  816.         IF CL% THEN
  817.            FastPrint 25, 65, "CAPS", 14
  818.         ELSE
  819.            FastPrint 25, 65, "    ", StatColour%
  820.         END IF
  821.         NL% = NumLock%(2)
  822.         IF NL% THEN
  823.            FastPrint 25, 70, "NUM", 14
  824.         ELSE
  825.            FastPrint 25, 70, "   ", StatColour%
  826.         END IF
  827.         SL% = ScrLock%(2)
  828.         IF SL% THEN
  829.            FastPrint 25, 74, "SCRL", 14
  830.         ELSE
  831.            FastPrint 25, 74, "    ", StatColour%
  832.         END IF
  833.         IF Mouse% THEN
  834.            MouseNow LeftButton%, RightButton%, xMouse%, yMouse%
  835.            IF LeftButton% THEN
  836.               IF yMouse% > 15 AND yMouse% < 24 THEN
  837.                  Z$ = CHR$(32): EXIT DO
  838.               END IF
  839.            END IF
  840.         END IF
  841.         Z$ = INKEY$
  842.     LOOP UNTIL Z$ = CHR$(27)
  843.     Frame Head$, 0
  844.     IF Mouse% THEN
  845.        CALL MouseHide: IF Z$ <> CHR$(27) THEN GOTO D002
  846.     END IF
  847. GOTO D400
  848.  
  849. '   Keyboard typeahead buffer.
  850. '
  851. D430:
  852.     COLOR 7, 0: Panel 4, 1, 21, 80, 1, 14
  853.     RESTORE KeyBuff: READ Items%
  854.     FOR I% = 1 TO Items%
  855.         READ Row%, Col%, Me$: LOCATE Row%, Col%, 0: PRINT Me$;
  856.     NEXT I%
  857.     LOCATE 11, 68: COLOR 11
  858.     Start% = &H400 + FarPeek%(&H40, &H80)
  859.     Finish% = &H400 + FarPeek%(&H40, &H82)
  860.     PRINT RIGHT$("0000" + HEX$(Start%), 4); " ";
  861.     PRINT RIGHT$("0000" + HEX$(Finish%), 4);
  862.     DO
  863.         Hd% = &H400 + FarPeek%(&H40, &H1A)
  864.         Tl% = &H400 + FarPeek%(&H40, &H1C)
  865.         LOCATE 11, 4: COLOR 11
  866.         PRINT RIGHT$("0000" + HEX$(Hd%), 4); " ";
  867.         PRINT RIGHT$("0000" + HEX$(Tl%), 4);
  868.         COLOR 13: LOCATE 9, 17: PRINT SPACE$(48);
  869.         LOCATE 9, 17 + ((Hd% - &H41E) \ 2) * 3: PRINT CHR$(25);
  870.         COLOR 12: LOCATE 13, 17: PRINT SPACE$(48);
  871.         LOCATE 13, 17 + ((Tl% - &H41E) \ 2) * 3: PRINT CHR$(24);
  872.         FOR I% = 0 TO 15
  873.             C% = FarPeek%(&H40, &H1E + (I% * 2))
  874.             S% = FarPeek%(&H40, &H1E + (I% * 2) + 1)
  875.             IF C% < 32 THEN Ky$ = "  " ELSE Ky$ = CHR$(C%) + " "
  876.             LOCATE 11, 17 + (I% * 3): COLOR 14: PRINT Ky$;
  877.             LOCATE 14, 17 + (I% * 3): COLOR 9
  878.             PRINT RIGHT$("0" + HEX$(C%), 2);
  879.             LOCATE 15, 17 + (I% * 3): COLOR 10
  880.             PRINT RIGHT$("0" + HEX$(S%), 2);
  881.         NEXT I%
  882.         IF Hd% >= Tl% THEN
  883.            Kys% = 16 - ((Hd% - Tl%) \ 2)
  884.         ELSE
  885.            Kys% = (Tl% - Hd%) \ 2
  886.         END IF
  887.         LOCATE 14, 76: IF Kys% = 16 THEN Kys% = 0
  888.         PRINT RIGHT$(" " + LTRIM$(RTRIM$(STR$(Kys%))), 2);
  889.         IF Kys% = 15 THEN
  890.            LOCATE 15, 67: COLOR 28: PRINT "BUFFER FULL";
  891.            SLEEP 2: KeyFlush: LOCATE , 67: PRINT SPACE$(11);
  892.         END IF
  893.     LOOP UNTIL FarPeek%(&H40, (Tl% - &H400) - 2) = 27
  894.     COLOR 7, 0: LOCATE 20, 1, 0
  895.     Dummy$ = INPUT$(Kys%)
  896. GOTO D400
  897.  
  898. '   Report mouse cursor position and status.
  899. '
  900. D440:
  901.     IF Mouse% THEN
  902.        Panel 4, 1, 21, 80, 1, TextColour%
  903.        CALL MouseShow
  904.        DO
  905.           MouseNow LeftButton%, RightButton%, xMouse%, yMouse%
  906.           Me$ = "x=" + LTRIM$(RTRIM$(STR$(xMouse%))) + "  "
  907.           FastPrint 12, 31, Me$, TextColour%
  908.           Me$ = "y=" + LTRIM$(RTRIM$(STR$(yMouse%))) + "  "
  909.           FastPrint 12, 41, Me$, TextColour%
  910.           IF LeftButton% THEN
  911.              IF yMouse% > 15 AND yMouse% < 24 THEN
  912.                 EXIT DO
  913.              ELSE
  914.                 Me$ = "Left button pressed"
  915.              END IF
  916.           ELSE
  917.              Me$ = "                   "
  918.           END IF
  919.           FastPrint 14, 31, Me$, TextColour%
  920.           IF RightButton% THEN
  921.              Me$ = "Right button pressed"
  922.           ELSE
  923.              Me$ = "                    "
  924.           END IF
  925.           FastPrint 15, 31, Me$, TextColour%: Z$ = INKEY$
  926.        LOOP UNTIL Z$ = CHR$(27)
  927.        CALL MouseHide
  928.        IF Z$ <> CHR$(27) THEN GOTO D002
  929.     ELSE
  930.        MisTake 9, "Mouse driver not installed", 0, Mouse%
  931.     END IF
  932. GOTO D400
  933.  
  934. '┌────────────────────────────────────────────────────────────────────────┐
  935. '│      Memory-related functions and procedures.                          │
  936. '└────────────────────────────────────────────────────────────────────────┘
  937. '
  938. D500:
  939.     IF EmsPresent% THEN Menu$(0) = "F#E" ELSE Menu$(0) = "F# "
  940.     Menu$(1) = "Operating system &Flags"
  941.     Menu$(3) = "&Expanded memory services"
  942.     Abort% = FALSE
  943.     VerMenu 4, 26, BarColour%, 1, 3, "MEMORY", Menu$(),_
  944.             Choice%, Nxt%, Bar%, 1, RootName$, Mouse%, HotKeys%
  945.     IF Nxt% THEN GOTO D002
  946.     SELECT CASE Choice%
  947.         CASE 1
  948.              GOTO D510
  949.         CASE 3
  950.              GOTO D520
  951.         CASE ELSE
  952.     END SELECT
  953. GOTO D002
  954.  
  955. '┌────────────────────────────────────────────────────────────────────────┐
  956. '│      System Flags.                                                     │
  957. '└────────────────────────────────────────────────────────────────────────┘
  958. '
  959. D510:
  960.     DIM CoOrd%(16, 2): Context% = 1: Topic$ = "FLAGS"
  961.     Panel 4, 1, 21, 80, 1, TextColour%: RESTORE Flags
  962.     FOR I% = 6 TO 21
  963.         READ Me$: FastPrint I%, 6, Me$, TextColour%
  964.     NEXT I%
  965.     Panel 6, 50, 16, 27, 2, 48
  966.     FastPrint 7, 53, "CURRENT FLAG SETTINGS", 48
  967.     FastPrint 8, 50, "╟" + STRING$(25, "─") + "╢", 48
  968.     FOR I% = 10 TO 17
  969.         READ Me$: FastPrint I%, 52, Me$, 48
  970.     NEXT I%
  971.     FOR I% = 1 TO 16
  972.         READ CoOrd%(I%, 1), CoOrd%(I%, 2): F% = GetFlag%(I%)
  973.         F$ = LTRIM$(RTRIM$(STR$(F%))): F$ = RIGHT$("   " + F$, 3)
  974.         FastPrint CoOrd%(I%, 1), CoOrd%(I%, 2), F$, 48
  975.     NEXT I%
  976.     FastPrint 19, 52, "Enter Flag Number:", 48
  977.     FastPrint 25, 3, SPACE$(78), StatColour%
  978.     FastPrint 25, 3, "Press <ESC> to Abort", StatColour%
  979.     DO
  980.        LOCATE 19, 73: HotKey% = FALSE
  981.        Number$ = RevInput$(2, 0, Number$, Nu$, 1, "REVINPUT", 0, HotKey%)
  982.        IF HotKey% THEN
  983.           Abort% = TRUE
  984.        ELSE
  985.           Number% = VAL(Number$)
  986.           IF Number% < 1 OR Number% > 16 THEN
  987.              BEEP
  988.           ELSE
  989.              Number$ = LTRIM$(RTRIM$(STR$(Number%)))
  990.              Number$ = RIGHT$("  " + Number$, 2)
  991.              FastPrint 19, 73, Number$, 48
  992.              Setting% = GetFlag%(Number%)
  993.              Setting$ = RIGHT$("   " + LTRIM$(RTRIM$(STR$(Setting%))), 3)
  994.              LOCATE CoOrd%(Number%, 1), CoOrd%(Number%, 2)
  995.              Setting$ = RevInput$(3, 0, Setting$, Nu$, 1, "REVINPUT",_
  996.                                   0, HotKey%)
  997.              IF HotKey% THEN
  998.                 Abort% = TRUE
  999.              ELSE
  1000.                 Setting% = VAL(Setting$)
  1001.                 IF Setting% < 0 OR Setting% > 255 THEN
  1002.                    BEEP
  1003.                 ELSE
  1004.                    SetFlag Number%, Setting%
  1005.                 END IF
  1006.                 Setting% = GetFlag%(Number%)
  1007.                 Setting$ = RIGHT$("   " + LTRIM$(RTRIM$(STR$(Setting%))), 3)
  1008.                 FastPrint CoOrd%(Number%, 1), CoOrd%(Number%, 2), Setting$, 48
  1009.              END IF
  1010.           END IF
  1011.        END IF
  1012.     LOOP UNTIL Abort%
  1013.     ERASE CoOrd%: Frame Head$, 0
  1014. GOTO D500
  1015.  
  1016. '┌────────────────────────────────────────────────────────────────────────┐
  1017. '│      Expanded Memory services.                                         │
  1018. '└────────────────────────────────────────────────────────────────────────┘
  1019. '
  1020. D520:
  1021.     Panel 4, 1, 21, 80, 1, TextColour%: Handle% = FALSE
  1022.     FastPrint 6, 23, "┌─────────────────────────────────┐", TextColour%
  1023.     FastPrint 7, 23, "│  EXPANDED MEMORY DEMONSTRATION  │", TextColour%
  1024.     FastPrint 8, 23, "└─────────────────────────────────┘", TextColour%
  1025.     Version% = EmsVersion%: PageFrame% = EmsFrame%
  1026.     EmsTotal% = EmsPages%(0): EmsFree% = EmsPages%(1)
  1027.     LIM$ = LTRIM$(RTRIM$(STR$(Version%))): L% = LEN(LIM$)
  1028.     IF L% > 1 THEN LIM$ = LEFT$(LIM$, L% - 1) + "." + RIGHT$(LIM$, 1)
  1029.     Me$ = "You have" + STR$(EmsTotal% * 16) + " KiloBytes of LIM "_
  1030.         + LIM$ + " Expanded Memory installed."
  1031.     FastPrint 10, 40 - (LEN(Me$) \ 2), Me$, TextColour%
  1032.     Me$ = "The Page Frame segment is at address " + HEX$(PageFrame%) + " Hex,"
  1033.     FastPrint 11, 40 - (LEN(Me$) \ 2), Me$, TextColour%
  1034.     Me$ = "and there are" + STR$(EmsFree%) + " pages ("_
  1035.         + LTRIM$(RTRIM$(STR$(EmsFree% * 16))) + "KB) free."
  1036.     FastPrint 12, 40 - (LEN(Me$) \ 2), Me$, TextColour%
  1037.     IF EmsFree% < 4 THEN
  1038.        Me$ = "Sorry, that's not enough for this demonstration."
  1039.        FastPrint 15, 40 - (LEN(Me$) \ 2), Me$, TextColour%: GOTO D525
  1040.     END IF
  1041.     SLEEP 1: KeyFlush: Me$ = "Requesting four pages for this demonstration,"
  1042.     FastPrint 14, 40 - (LEN(Me$) \ 2), Me$, TextColour%
  1043.     EmsRequest 4, Handle%: IF Handle% = 0 THEN GOTO D529
  1044.     Pages% = EmsOwned%(Handle%): IF Pages% < 4 THEN GOTO D529
  1045.     Me$ = "they have been assigned to Handle" + STR$(Handle%) + "."
  1046.     FastPrint 15, 40 - (LEN(Me$) \ 2), Me$, TextColour%
  1047.     Me$ = "Saving this screen to page 1": SLEEP 1: KeyFlush
  1048.     FastPrint 17, 40 - (LEN(Me$) \ 2), Me$, TextColour%
  1049.     IF Colour% THEN Segment% = &HB800 ELSE Segment% = &HB000
  1050.     SLEEP 1: KeyFlush: Me$ = "Drawing and saving three other screens ...."
  1051.     FastPrint 17, 40 - (LEN(Me$) \ 2), Me$, TextColour%
  1052.     EmsPut Segment%, 0, 4000, 1, Handle%, Done%
  1053.     IF NOT Done% THEN GOTO D529
  1054.     SLEEP 1: KeyFlush: FastPrint 25, 1, SPACE$(80), StatColour%
  1055.     Page% = 2: Row% = 11: Col% = 35
  1056.     RESTORE Numbers
  1057.     DO
  1058.         READ Columns%, BackGround%: IF NOT Colour% THEN BackGround% = 0
  1059.         Attr% = Attribute%(15, BackGround%)
  1060.         BackFill 4, 1, 21, 80, Attr%
  1061.         Scroll 1, 9, 2, 23, 79, 0, Attr%
  1062.         FastPrint 10, 36, "P A G E", Attr%
  1063.         FOR I% = 1 TO Columns%
  1064.             READ Item$: IF Item$ = "F" THEN Item$ = "12345678"
  1065.             FOR J% = 1 TO LEN(Item$)
  1066.                 Rows% = VAL(MID$(Item$, J%, 1))
  1067.                 FastPrint Row% + Rows%, Col% + I%, CHR$(219), Attr%
  1068.             NEXT J%
  1069.         NEXT I%
  1070.         EmsPut Segment%, 0, 4000, Page%, Handle%, Done%
  1071.         Page% = Page% + 1: IF NOT Done% THEN EXIT DO
  1072.         SLEEP 1: KeyFlush
  1073.     LOOP UNTIL Page% > 4
  1074.     IF NOT Done% THEN GOTO D529
  1075.     EmsGet Segment%, 0, 4000, 1, Handle%, Done%
  1076.     IF NOT Done% THEN GOTO D529
  1077.     Me$ = "Now I'll let YOU bring 'em back again ...."
  1078.     FastPrint 19, 40 - (LEN(Me$) \ 2), Me$, TextColour%
  1079.     FastPrint 22, 24, "Press a key when you're ready >", TextColour%
  1080.     LOCATE 22, 56, 1: Page% = 4: IF KeyIn% = 27 THEN GOTO D525
  1081.     DO
  1082.        EmsGet Segment%, 0, 4000, Page%, Handle%, Done%
  1083.        IF NOT Done% THEN EXIT DO
  1084.        FastPrint 25, 63, "Press a key >", StatColour%
  1085.        LOCATE 25, 77: KeyPress% = KeyIn%
  1086.        Page% = Page% - 1
  1087.     LOOP WHILE Page% > 1
  1088.     IF Done% THEN EmsGet Segment%, 0, 4000, 1, Handle%, Done%
  1089.     LOCATE , , 0: IF NOT Done% THEN GOTO D529
  1090.     Me$ = "The demonstration was completely successful, which proves that"
  1091.     FastPrint 17, 40 - (LEN(Me$) \ 2), Me$, TextColour%
  1092.     Me$ = "your Expanded Memory is in good working order."
  1093.     FastPrint 18, 40 - (LEN(Me$) \ 2), Me$, TextColour%
  1094. D525:
  1095.     IF Handle% THEN
  1096.        SLEEP 1: KeyFlush: EmsRelease Handle%
  1097.        Me$ = "We released all pages assigned to handle" + STR$(Handle%)_
  1098.            + " before finishing,"
  1099.        FastPrint 20, 40 - (LEN(Me$) \ 2), Me$, TextColour%
  1100.        Me$ = "otherwise no other program would have been able to use them."
  1101.        FastPrint 21, 40 - (LEN(Me$) \ 2), Me$, TextColour%
  1102.     END IF
  1103.     SLEEP 2: KeyFlush
  1104. GOTO D500
  1105.  
  1106. D529:
  1107.     Me$ = "An EMM error" + STR$(EmsError%) + " has just occurred ..."
  1108.     MisTake 12, Me$, 0, Mouse%
  1109. GOTO D525
  1110.  
  1111. '┌────────────────────────────────────────────────────────────────────────┐
  1112. '│      Miscellaneous functions and procedures.                           │
  1113. '└────────────────────────────────────────────────────────────────────────┘
  1114. '
  1115. D600:
  1116.     Menu$(0) = "DHEFP"
  1117.     Menu$(1) = "&Date entry and validation"
  1118.     Menu$(2) = "&Hardware equipment list"
  1119.     Menu$(3) = "&Encryption of text"
  1120.     Menu$(4) = "&Fast string sorting"
  1121.     Menu$(5) = "&Percentage box"
  1122.     Abort% = FALSE
  1123.     VerMenu 4, 34, BarColour%, 1, 5, "EXAMPLES", Menu$(),_
  1124.             Choice%, Nxt%, Bar%, 1, RootName$, Mouse%, HotKeys%
  1125.     IF Nxt% THEN GOTO D002
  1126.     SELECT CASE Choice%
  1127.         CASE 1
  1128.              GOTO D610
  1129.         CASE 2
  1130.              GOTO D620
  1131.         CASE 3
  1132.              GOTO D630
  1133.         CASE 4
  1134.              GOTO D640
  1135.         CASE 5
  1136.              GOTO D650
  1137.         CASE ELSE
  1138.     END SELECT
  1139. GOTO D002
  1140.  
  1141. '┌────────────────────────────────────────────────────────────────────────┐
  1142. '│      Long Date Routine.                                                │
  1143. '└────────────────────────────────────────────────────────────────────────┘
  1144. '
  1145. D610:
  1146.     IF Colour% THEN Attrib% = 48 ELSE Attrib% = 112
  1147.     HotKey% = FALSE: IF ToDay$ = "" THEN ToDay$ = SPACE$(20)
  1148.     Context% = 1: Topic$ = "LONGDATE": WW% = LEN(ToDay$)
  1149.     WT% = 41 - (WW% \ 2): PopUp 8, 24, 8, 34, Attrib%, 3, 2, -1
  1150.     FastPrint 9, 33, "Today's date is:", Attrib%
  1151.     FastPrint 10, WT%, ToDay$, Attrib%
  1152.     Ok% = Verify%(1, 12, "Is this correct", 0, Mouse%)
  1153.     IF NOT Ok% THEN
  1154.        FastPrint 12, 32, "Enter correct date", Attrib%
  1155.        Temp$ = "": LOCATE 14, 37
  1156.        Temp$ = DateInput$(Temp$, 1, "DATINPUT", HotKey%)
  1157.        IF HotKey% THEN
  1158.           Abort% = TRUE
  1159.        ELSE
  1160.           Now$ = Temp$: MO% = VAL(MID$(Temp$, 4, 2))
  1161.           DY% = VAL(LEFT$(Temp$, 2)): YR% = VAL(RIGHT$(Temp$, 2))
  1162.           ToDay$ = LongDate$(DY%, MO%, YR%): OL% = LEN(ToDay$)
  1163.           IF OL% > 0 THEN
  1164.              FastPrint 25, 41, SPACE$(40), StatColour%
  1165.              FastPrint 25, 79 - OL%, ToDay$, StatColour%
  1166.           END IF
  1167.        END IF
  1168.     END IF
  1169.     ShutUp -1
  1170. GOTO D600
  1171.  
  1172. '┌────────────────────────────────────────────────────────────────────────┐
  1173. '│      Equipment List.                                                   │
  1174. '└────────────────────────────────────────────────────────────────────────┘
  1175. '
  1176. D620:
  1177.     Panel 4, 1, 21, 80, 1, TextColour%
  1178.     Cols$ = "80": Video$ = "colour": REDIM Model(0 TO 8) AS STRING
  1179.     RESTORE HWare: FOR I% = 0 TO 8: READ Model(I%): NEXT
  1180.     Equipment% = PeekWord&(&H40, &H10): Flag$ = STRING$(16, "0")
  1181.     Computer% = FarPeek%(&HF000, &HFFFE)
  1182.     Computer% = Computer% - &HF8: IF Computer% < 0 THEN Computer% = 0
  1183.     FastPrint 8, 38, "IBM " + Model(Computer%) + " or compatible", TextColour%
  1184.     Chip% = Cpu%: CoPro% = MathsChip%
  1185.     SELECT CASE Chip%
  1186.         CASE IS < 0
  1187.              Me$ = " an Intel 80C" + LTRIM$(RTRIM$(STR$(ABS(Chip%))))
  1188.         CASE 20, 30
  1189.              Me$ = " a NEC V" + LTRIM$(RTRIM$(STR$(Chip%)))
  1190.         CASE 88 TO 486
  1191.              Me$ = " an Intel 80" + LTRIM$(RTRIM$(STR$(Chip%)))
  1192.         CASE ELSE
  1193.              Me$ = " an unknown"
  1194.     END SELECT
  1195.     Me$ = "with" + Me$ + " microprocessor"
  1196.     FastPrint 9, 38, Me$, TextColour%
  1197.     FOR I% = 15 TO 0 STEP -1
  1198.         IF BitTest%(Equipment%, I%) THEN
  1199.            MID$(Flag$, 16 - I%, 1) = "1"
  1200.         END IF
  1201.     NEXT I%
  1202.     FastPrint 8, 3, " F E D C B A 9 8 7 6 5 4 3 2 1 0", TextColour%
  1203.     FastPrint 9, 3, "┌─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┐", TextColour%
  1204.     FastPrint 10, 3, "│", TextColour%: Col% = 4
  1205.     FOR I% = 1 TO 16
  1206.         FastPrint 10, Col%, MID$(Flag$, I%, 1) + "│", TextColour%
  1207.         Col% = Col% + 2
  1208.     NEXT I%
  1209.     FastPrint 10, 38, "ROM BIOS Equipment Flag at 0040:0010", TextColour%
  1210.     FastPrint 11, 3, "└─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┘", TextColour%
  1211.     FastPrint 12, 3, " │ │   │ │ │ │   │ │ │ │ │ │ │ │", TextColour%
  1212.     FastPrint 13, 3, " │ │   │ │ │ │   │ │ │ │ │ │ │ └─", TextColour%
  1213.     FastPrint 14, 3, " │ │   │ │ │ │   │ │ │ │ │ │ └───", TextColour%
  1214.     FastPrint 15, 3, " │ │   │ │ │ │   │ │ │ │ └─┴─────", TextColour%
  1215.     FastPrint 16, 3, " │ │   │ │ │ │   │ │ └─┴─────────", TextColour%
  1216.     FastPrint 17, 3, " │ │   │ │ │ │   └─┴─────────────", TextColour%
  1217.     FastPrint 18, 3, " │ │   │ └─┴─┴───────────────────", TextColour%
  1218.     FastPrint 19, 3, " │ │   └─────────────────────────", TextColour%
  1219.     FastPrint 20, 3, " └─┴─────────────────────────────", TextColour%
  1220.     FastPrint 13, 38, "Floppy drives installed?", TextColour%
  1221.     IF MID$(Flag$, 16, 1) = "1" THEN Me$ = "Yes" ELSE Me$ = "No"
  1222.     FastPrint 13, 68, Me$, TextColour%
  1223.     FastPrint 14, 38, "Maths coprocessor installed?", TextColour%
  1224.     IF MID$(Flag$, 15, 1) = "1" THEN Me$ = "Yes" ELSE Me$ = "No"
  1225.     IF CoPro% > 0 THEN Me$ = "80" + LTRIM$(RTRIM$(STR$(CoPro%)))
  1226.     FastPrint 14, 68, Me$, TextColour%
  1227.     FastPrint 15, 38, "Original PC motherboard RAM", TextColour%
  1228.     IF Computer% = 1 THEN
  1229.        Ram% = (BinDec&(MID$(Flag$, 13, 2)) + 1) * 16
  1230.        Me$ = RIGHT$("  " + LTRIM$(RTRIM$(STR$(Ram%))), 2) + "KB"
  1231.     ELSE
  1232.        Me$ = "n/a"
  1233.     END IF
  1234.     FastPrint 15, 68, Me$, TextColour%
  1235.     FastPrint 16, 38, "Initial Video mode", TextColour%
  1236.     Mode% = BinDec&(MID$(Flag$, 11, 2))
  1237.     IF Mode% = 1 THEN Cols$ = "40"
  1238.     IF Mode% = 7 THEN Video$ = "mono"
  1239.     FastPrint 16, 58, Cols$ + " column " + Video$, TextColour%
  1240.     FastPrint 17, 38, "Number of floppy drives", TextColour%
  1241.     Mode% = BinDec&(MID$(Flag$, 9, 2)) + 1
  1242.     Me$ = LTRIM$(RTRIM$(STR$(Mode%))): FastPrint 17, 68, Me$, TextColour%
  1243.     FastPrint 18, 38, "Number of serial ports", TextColour%
  1244.     Mode% = BinDec&(MID$(Flag$, 5, 3)) + 1
  1245.     Me$ = LTRIM$(RTRIM$(STR$(Mode%))): FastPrint 18, 68, Me$, TextColour%
  1246.     FastPrint 19, 38, "Games adaptor installed?", TextColour%
  1247.     IF MID$(Flag$, 3, 1) = "1" THEN Me$ = "Yes" ELSE Me$ = "No"
  1248.     FastPrint 19, 68, Me$, TextColour%
  1249.     FastPrint 20, 38, "Number of parallel printers", TextColour%
  1250.     Mode% = BinDec&(LEFT$(Flag$, 2))
  1251.     Me$ = LTRIM$(RTRIM$(STR$(Mode%))): FastPrint 20, 68, Me$, TextColour%
  1252.     FastPrint 25, 1, SPACE$(80), StatColour%
  1253.     FastPrint 25, 3, "Press a key to continue", StatColour%
  1254.     IF Mouse% THEN MouseShow
  1255.     DO
  1256.        IF Mouse% THEN
  1257.           MouseNow LeftButton%, RightButton%, xMouse%, yMouse%
  1258.           IF LeftButton% THEN
  1259.              IF yMouse% > 15 AND yMouse% < 24 THEN
  1260.                 Z$ = "": EXIT DO
  1261.              END IF
  1262.           END IF
  1263.        END IF
  1264.        Z$ = INKEY$
  1265.     LOOP WHILE Z$ = ""
  1266.     Frame Head$, 0: ERASE Model
  1267.     IF Mouse% THEN
  1268.        CALL MouseHide: IF Z$ = "" THEN GOTO D002
  1269.     END IF
  1270. GOTO D600
  1271.  
  1272. '   Text Encryption.
  1273. '
  1274. D630:
  1275.     Panel 4, 1, 21, 80, 1, TextColour%
  1276.     Done% = FALSE: Abort% = FALSE: HotKey% = FALSE
  1277.     Text$ = "": Code$ = ""
  1278.     RESTORE Crypt
  1279.     FOR I% = 1 TO 5
  1280.         READ Me$: FastPrint 6 + I%, 11, Me$, TextColour%
  1281.     NEXT I%
  1282.     IF Colour% THEN Attrib% = 32 ELSE Attrib% = 112
  1283.     DO WHILE Text$ = ""
  1284.        PopUp 17, 19, 4, 44, Attrib%, 2, 2, -1
  1285.        FastPrint 18, 27, "Enter string to be encrypted", Attrib%
  1286.        LOCATE 19, 21
  1287.        Text$ = RevInput$(40, 0, "", "", 1, "REVINPUT", -1, HotKey%)
  1288.        ShutUp -1: IF HotKey% THEN Abort% = TRUE: EXIT DO
  1289.        Text$ = LTRIM$(RTRIM$(Text$))
  1290.        IF Text$ = "" THEN
  1291.           MisTake 9, "You can't encrypt an empty string!", 0, Mouse%
  1292.        END IF
  1293.     LOOP
  1294.     IF NOT Abort% THEN
  1295.        IF Colour% THEN Attrib% = 78 ELSE Attrib% = 112
  1296.        DO WHILE Code$ = ""
  1297.           PopUp 17, 19, 4, 44, Attrib%, 2, 2, -1
  1298.           FastPrint 18, 25, "Enter string to encrypt it with", Attrib%
  1299.           LOCATE 19, 21
  1300.           Code$ = RevInput$(40, 0, "", "", 1, "REVINPUT", -1, HotKey%)
  1301.           ShutUp -1: IF HotKey% THEN Abort% = TRUE: EXIT DO
  1302.           Code$ = LTRIM$(RTRIM$(Code$))
  1303.           IF Code$ = "" THEN
  1304.              MisTake 12, "An empty string is no use!", 0, Mouse%
  1305.           END IF
  1306.        LOOP
  1307.        IF NOT Abort% THEN
  1308.           Cipher Text$, Code$: Me$ = "Encrypted string >  " + Text$
  1309.           FastPrint 14, 11, Me$, TextColour%
  1310.           IF Colour% THEN Attrib% = 48 ELSE Attrib% = 112
  1311.           DO
  1312.              DO
  1313.                 PopUp 19, 19, 4, 44, Attrib%, 2, 2, -1
  1314.                 FastPrint 20, 27, "Enter key string once again", Attrib%
  1315.                 LOCATE 21, 21
  1316.                 DeCode$ = RevInput$(40, 0, "", "", 1, "REVINPUT", -1, HotKey%)
  1317.                 ShutUp -1: IF HotKey% THEN Abort% = TRUE: EXIT DO
  1318.                 DeCode$ = LTRIM$(RTRIM$(DeCode$))
  1319.                 IF DeCode$ = "" THEN
  1320.                    MisTake 12, "An empty string is no use!", 0, Mouse%
  1321.                 END IF
  1322.              LOOP WHILE DeCode$ = ""
  1323.              IF Abort% THEN
  1324.                 Done% = TRUE
  1325.              ELSE
  1326.                 Me$ = Text$: Cipher Me$, DeCode$
  1327.                 Me$ = "Decrypted string >  " + Me$
  1328.                 FastPrint 16, 11, Me$, TextColour%
  1329.                 IF Code$ = DeCode$ THEN
  1330.                    FastPrint 19, 33, "That's the one!", TextColour%
  1331.                    Done% = TRUE
  1332.                 ELSE
  1333.                    Me$ = "Whoops, that's not right"
  1334.                    IF MisMatch% THEN
  1335.                       Me$ = Me$ + " either"
  1336.                    END IF
  1337.                    MisTake 9, Me$ + "!", 0, Mouse%
  1338.                    MisMatch% = TRUE
  1339.                 END IF
  1340.              END IF
  1341.           LOOP UNTIL Done%
  1342.        END IF
  1343.     END IF
  1344. GOTO D600
  1345.  
  1346. '   Demonstrate string array sorting and scan routines.
  1347. '
  1348. D640:
  1349.     Room% = TRUE: Me$ = "Not enough memory for sort array"
  1350.     ON ERROR GOTO D645
  1351.     REDIM Array(1 TO 1000) AS STRING
  1352.     ON ERROR GOTO Trap
  1353.     IF NOT Room% THEN GOTO D600
  1354.     RESTORE Strings: IF Colour% THEN COLOR 0, 7
  1355.     Panel 4, 1, 21, 80, 1, TextColour%
  1356.     FOR Row% = 6 TO 7
  1357.         READ Me$: LOCATE Row%, 3: PRINT Me$
  1358.     NEXT Row%
  1359.     FOR I% = 1 TO 1000
  1360.         FOR J% = 1 TO Rand%(5, 11)
  1361.             Array(I%) = Array(I%) + CHR$(Rand%(0, 25) + 65)
  1362.         NEXT J%
  1363.     NEXT I%
  1364.     LOCATE 7, 50: PRINT "done!"
  1365.     LOCATE 9, 3: PRINT "Unsorted array"
  1366.     FOR I% = 1 TO 3
  1367.         Me$ = "Element " + RIGHT$("    " + LTRIM$(RTRIM$(STR$(I%))), 4)
  1368.         LOCATE 10 + I%, 3: PRINT Me$; " "; Array(I%)
  1369.     NEXT I%
  1370.     LOCATE 14, 3: PRINT "  .": Row% = 15
  1371.     FOR I% = 998 TO 1000
  1372.         Me$ = "Element " + RIGHT$("    " + LTRIM$(RTRIM$(STR$(I%))), 4)
  1373.         LOCATE Row%, 3: PRINT Me$; " "; Array(I%): Row% = Row% + 1
  1374.     NEXT I%
  1375.     PopUp 19, 13, 5, 53, BarColour%, 4, 4, 0
  1376.     READ Me$: FastPrint 21, 15, Me$, BarColour%
  1377.     LOCATE 21, 62: Legal$ = "AaDd"
  1378.     A$ = UCASE$(RevInput$(1, 0, "A", Legal$, 1, "REVINPUT", 0, HotKey%))
  1379.     ShutUp 0: IF Colour% THEN COLOR 0, 7
  1380.     IF HotKey% THEN Abort% = TRUE: GOTO D642
  1381.     IF A$ = "D" THEN
  1382.        Direction% = 1: A$ = "descending"
  1383.     ELSE
  1384.        Direction% = 0: A$ = "ascending"
  1385.     END IF
  1386.     LOCATE 19, 3: PRINT "Sorting the array into "; A$; " order ....";
  1387.     First% = LBOUND(Array): Last% = UBOUND(Array)
  1388.     X! = TIMER
  1389.     StringSort Direction%, 1000, VARPTR(Array(First%))
  1390.     Y! = TIMER
  1391.     PRINT " done!": LOCATE 9, 41: PRINT "Sorted array"
  1392.     FOR I% = 1 TO 3
  1393.         Me$ = "Element " + RIGHT$("    " + LTRIM$(RTRIM$(STR$(I%))), 4)
  1394.         LOCATE 10 + I%, 41: PRINT Me$; " "; Array(I%)
  1395.     NEXT I%
  1396.     LOCATE 14, 41: PRINT "  .": Row% = 15
  1397.     FOR I% = 998 TO 1000
  1398.         Me$ = "Element " + RIGHT$("    " + LTRIM$(RTRIM$(STR$(I%))), 4)
  1399.         LOCATE Row%, 41: PRINT Me$; " "; Array(I%): Row% = Row% + 1
  1400.     NEXT I%
  1401.     LOCATE 20, 3: PRINT USING "The sort took ###.### seconds"; Y! - X!
  1402.     Ok% = Verify%(1, 16, "Search array", 0, Mouse%): IF NOT Ok% THEN GOTO D642
  1403. D641:
  1404.     PopUp 12, 17, 8, 46, BarColour%, 3, 4, -1: HotKey% = 0
  1405.     FastPrint 14, 20, "Enter a string to insert into the array", BarColour%
  1406.     LOCATE 15, 30: A$ = RevInput$(20, 0, "", "", 1, "REVINPUT", 0, HotKey%)
  1407.     IF HotKey% THEN Abort% = TRUE: ShutUp -1: GOTO D642
  1408.     A$ = LTRIM$(RTRIM$(A$))
  1409.     Me$ = "Enter element to insert it into (1-"_
  1410.         + LTRIM$(RTRIM$(STR$(Last%))) + ") "
  1411.     FastPrint 16, 40 - (LEN(Me$) \ 2), Me$, BarColour%
  1412.     LOCATE 17, 38: Temp$ = RevInput$(4, 0, "", Nu$, 1, "REVINPUT", 0, HotKey%)
  1413.     ShutUp -1: IF Colour% THEN COLOR 0, 7
  1414.     IF HotKey% THEN
  1415.        Abort% = TRUE: GOTO D642
  1416.     ELSE
  1417.        S% = VAL(Temp$)
  1418.        IF S% < First% OR S% > Last% THEN
  1419.           MisTake 9, "OUT OF RANGE!", 0, Mouse%
  1420.           GOTO D641
  1421.        ELSE
  1422.           Array(S%) = A$
  1423.           IF S% < 4 THEN
  1424.              LOCATE 10 + S%, 54: PRINT SPACE$(12);
  1425.              LOCATE 10 + S%, 54: PRINT A$;
  1426.           ELSEIF S% > 997 THEN
  1427.              LOCATE S% - 983, 54: PRINT SPACE$(12);
  1428.              LOCATE S% - 983, 54: PRINT A$;
  1429.           END IF
  1430.        END IF
  1431.     END IF
  1432.     LOCATE 21, 3: PRINT "Scanning array for " + A$ + " .... ";
  1433.     X! = TIMER
  1434.     Match% = StringScan%(A$, 1000, First%, VARPTR(Array$(First%)))
  1435.     Y! = TIMER
  1436.     PRINT "found it at element"; Match%
  1437.     LOCATE 22, 3: PRINT USING "The search took ###.### seconds"; Y! - X!
  1438. D642:
  1439.     ERASE Array: IF Colour% THEN COLOR 7, 0
  1440. GOTO D002
  1441.  
  1442. D645:
  1443.     MisTake 9, Me$, 0, Mouse%
  1444.     Room% = FALSE
  1445. RESUME NEXT
  1446.  
  1447. '   Display a popup window with a percentage bar measuring the progress
  1448. '   of a function or procedure.
  1449. '
  1450. D650:
  1451.     PerCentBox 1, "Passing the time away", 0, 0
  1452.     StartTime& = TIMER
  1453.     DO
  1454.         ThisTime& = TIMER - StartTime&
  1455.         Percentage% = (ThisTime& / 30) * 100
  1456.         PerCentBox 2, "", 0, Percentage%
  1457.         IF INKEY$ = CHR$(27) THEN EXIT DO
  1458.     LOOP UNTIL ThisTime& > 30
  1459.     PerCentBox 3, "", 0, 0
  1460. GOTO D600
  1461.  
  1462. '┌────────────────────────────────────────────────────────────────────────┐
  1463. '│      Graphics examples.                                                │
  1464. '└────────────────────────────────────────────────────────────────────────┘
  1465. '
  1466. D700:
  1467.     VideoMode Colour%, MaxRes%, VideoRam%
  1468.     IF MaxRes% > 8 THEN
  1469.        Menu$(0) = "CP#SR"
  1470.     ELSEIF MaxRes% AND MaxRes% <> 3 THEN
  1471.        Menu$(0) = "C #  "
  1472.     ELSE
  1473.        Menu$(0) = "  #  "
  1474.     END IF
  1475.     Menu$(1) = "Graphics &characters"
  1476.     Menu$(2) = "Video &panning"
  1477.     Menu$(4) = "&Save screen to file"
  1478.     Menu$(5) = "&Restore screen"
  1479.     VerMenu 4, 47, BarColour%, 1, 5, "GRAPHICS", Menu$(),_
  1480.             Choice%, Nxt%, Bar%, 1, RootName$, Mouse%, HotKeys%
  1481.     IF Nxt% THEN GOTO D002
  1482.     SELECT CASE Choice%
  1483.         CASE 1
  1484.              GOTO D710
  1485.         CASE 2
  1486.              GOTO D720
  1487.         CASE 4, 5
  1488.              GOTO D730
  1489.         CASE ELSE
  1490.     END SELECT
  1491. GOTO D002
  1492.  
  1493. '┌────────────────────────────────────────────────────────────────────────┐
  1494. '│      Graphics characters.                                              │
  1495. '└────────────────────────────────────────────────────────────────────────┘
  1496. '
  1497. D710:
  1498.     SELECT CASE MaxRes%
  1499.         CASE 2                                  ' Colour Graphics Adaptor
  1500.              Mode = 1
  1501.              SCREEN 1                           ' 320 x 200   4-colour
  1502.         CASE 9                                  ' Enhanced Graphics Adaptor
  1503.              Mode = 2
  1504.              SCREEN 9                           ' 640 x 350  16-colour
  1505.              WINDOW SCREEN (0, 0)-(319, 199)
  1506.         CASE 13
  1507.              IF VideoRam% > 64 THEN
  1508.                 Mode = 3                        ' Video Graphics Array
  1509.                 SCREEN 12                       ' 640 X 480  16-colour
  1510.                 WINDOW SCREEN (0, 0)-(319, 199)
  1511.              ELSE
  1512.                 Mode = 4                        ' Multicolour Graphics Array
  1513.                 SCREEN 13                       ' 320 x 200 256-colour
  1514.              END IF
  1515.         CASE ELSE
  1516.              MisTake 9, "Incompatible Video Card!", 0, Mouse%
  1517.              GOTO D002
  1518.     END SELECT
  1519.  
  1520.     REDIM Hue(1 TO 4) AS INTEGER
  1521.     PLAY "mft240o3l8d#fgl8b-p8l8gl2b-"          ' Hoop-la!
  1522.     RESTORE Title
  1523.     PLAY "mbl8t255o3bo4cdo3bo4co3abgaf#t120gbt200dp8"
  1524.     FOR I% = 1 TO 4: READ Hue(I%): NEXT
  1525.     READ Count%, X1%, Y1%, X2%, Y2%
  1526.     LINE (X1%, Y1%)-(X2%, Y2%), Hue(Mode)
  1527.     FOR I% = 1 TO Count%
  1528.         READ X%, Y%: LINE -(X%, Y%), Hue(Mode)
  1529.     NEXT I%
  1530.     LINE (0, 165)-(259, 165), Hue(Mode)
  1531.     IF Mode = 1 THEN
  1532.        Road$ = CHR$(&H22) + CHR$(11) + CHR$(&H88) + CHR$(44)
  1533.        Tree$ = CHR$(&H11) + CHR$(&H88) + CHR$(&H44) + CHR$(&H22)
  1534.        PAINT (5, 5), 2, Hue(Mode)
  1535.        PAINT (310, 100), 1, Hue(Mode)
  1536.        PAINT (250, 163), Road$, Hue(Mode)
  1537.        PAINT (10, 100), 1, Hue(Mode)
  1538.        LINE (0, 165)-(319, 165), 0
  1539.     ELSE
  1540.        PAINT (5, 5), 9, Hue(Mode)
  1541.        PAINT (310, 100), Hue(Mode), Hue(Mode)
  1542.        PAINT (250, 163), 8, Hue(Mode)
  1543.        PAINT (10, 100), Hue(Mode), Hue(Mode)
  1544.        LINE (0, 165)-(319, 165), 0
  1545.     END IF
  1546.     PSET (57, 113), Hue(Mode)
  1547.     FOR I% = 1 TO 4: READ Hue(I%): NEXT
  1548.     READ Count%, X1%, Y1%, X2%, Y2%
  1549.     LINE (X1%, Y1%)-(X2%, Y2%), Hue(Mode)
  1550.     FOR I% = 1 TO Count%
  1551.         READ X%, Y%: LINE -(X%, Y%), Hue(Mode)
  1552.     NEXT I%
  1553.     CIRCLE (127, 109), 45, Hue(Mode), 1.35, 3.1, .3
  1554.     CIRCLE (166, 102), 35, Hue(Mode), 1, 2.8, .43
  1555.     CIRCLE (214, 95), 32, Hue(Mode), 1.1, 2.8, .39
  1556.     CIRCLE (259, 94), 38, Hue(Mode), .7, 2.6, .48
  1557.     CIRCLE (296, 96), 33, Hue(Mode), .1, 1.92, .45
  1558.     IF Mode = 1 THEN
  1559.        PAINT (215, 90), Tree$, Hue(Mode)
  1560.     ELSE
  1561.        PAINT (215, 90), Hue(Mode), Hue(Mode)
  1562.     END IF
  1563.     PSET (83, 108), Hue(Mode)
  1564.     FOR I% = 1 TO 4: READ Hue(I%): NEXT
  1565.     READ Count%, X1%, Y1%, X2%, Y2%
  1566.     LINE (X1%, Y1%)-(X2%, Y2%), Hue(Mode)
  1567.     FOR I% = 1 TO Count%
  1568.         READ X%, Y%: LINE -(X%, Y%), Hue(Mode)
  1569.     NEXT I%
  1570.     LINE (270, 72)-(276, 86), Hue(Mode), BF
  1571.     PAINT (260, 95), Hue(Mode), Hue(Mode)
  1572.     IF Mode = 1 THEN
  1573.        LINE (215, 86)-(260, 73), 0: LINE -(305, 86), 0
  1574.        LINE (226, 88)-(246, 93), 1, BF: LINE (274, 88)-(294, 93), 1, BF
  1575.        LINE (255, 88)-(265, 98), 2, BF: LINE (271, 70)-(272, 71), 0, BF
  1576.        LINE (274, 70)-(275, 71), 0, BF
  1577.     ELSE
  1578.        LINE (215, 86)-(260, 73), 4: LINE -(305, 86), 4
  1579.        LINE (226, 88)-(246, 93), 26, BF: LINE (274, 88)-(294, 93), 26, BF
  1580.        LINE (255, 88)-(265, 98), 6, BF: LINE (271, 70)-(272, 71), 6, BF
  1581.        LINE (274, 70)-(275, 71), 6, BF: LINE (319, 98)-(220, 98), 8
  1582.        LINE -(186, 99), 8: LINE -(159, 101), 8: LINE -(210, 100), 8
  1583.        LINE -(319, 100), 8: PAINT (300, 99), 8, 8
  1584.     END IF
  1585.     PLAY "t255o4cdecdo3bo4co3abgt120f#at200dp8"
  1586.     FOR I% = 1 TO 4: READ Hue(I%): NEXT
  1587.     LINE (320, 102)-(285, 102), Hue(Mode)
  1588.     CIRCLE (292, 102), 6, Hue(Mode), .8, 3.1415, .7
  1589.     CIRCLE (302, 102), 9, Hue(Mode), .8, 2.5, .75
  1590.     CIRCLE (318, 102), 16, Hue(Mode), .6, 2.7, .85
  1591.     IF Mode = 1 THEN
  1592.        LINE (320, 94)-(307, 93), 1
  1593.        PAINT (310, 95), Tree$, Hue(Mode), CHR$(&HAA)
  1594.        GraPrint 256, 78, "A", GrAttrib%(0, 3), 1
  1595.        LINE (76, 6)-(244, 32), 3, BF: LINE (76, 32)-(244, 52), 1, BF
  1596.     ELSE
  1597.        PAINT (310, 100), Hue(Mode), Hue(Mode)
  1598.        IF Mode = 2 THEN
  1599.           GraPrint 517, 136, "A", GrAttrib%(1, -1), 1
  1600.        ELSEIF Mode = 3 THEN
  1601.           GraPrint 517, 190, "A", GrAttrib%(1, -1), 1
  1602.        ELSE
  1603.           GraPrint 256, 78, "A", GrAttrib%(27, -1), 1
  1604.        END IF
  1605.        LINE (76, 6)-(244, 32), 14, BF: LINE (76, 32)-(244, 52), 15, BF
  1606.     END IF
  1607.     Me$ = "GRAPHICS": I% = 1: X% = 80: Y% = 9
  1608.     IF Mode = 1 THEN
  1609.        Clr% = GrAttrib%(0, 3): Box% = 0
  1610.     ELSE
  1611.        Clr% = GrAttrib%(1, -1): Box% = 1
  1612.     END IF
  1613.     DO
  1614.         LINE (X%, Y%)-(X% + 20, Y% + 20), Box%, B
  1615.         IF Mode = 2 THEN
  1616.            GraPrint ((X% * 2) + 8), (Y% * 1.4) + 3, MID$(Me$, I%, 1), Clr%, 3
  1617.         ELSEIF Mode = 3 THEN
  1618.            GraPrint ((X% * 2) + 8), (Y% * 2.4) + 3, MID$(Me$, I%, 1), Clr%, 3
  1619.         ELSE
  1620.            GraPrint X% + 3, Y% + 3, MID$(Me$, I%, 1), Clr%, 2
  1621.         END IF
  1622.         I% = I% + 1: X% = X% + 20
  1623.     LOOP UNTIL I% > 8
  1624.     Me$ = "CHARACTERS": I% = 1: X% = 78: Y% = 32
  1625.     IF Mode = 1 THEN
  1626.        Clr% = GrAttrib%(2, 1)
  1627.     ELSE
  1628.        Clr% = GrAttrib%(7, -1)
  1629.     END IF
  1630.     DO
  1631.         IF Mode = 2 THEN
  1632.            GraPrint ((X% * 2) + 8), (Y% * 1.6) + 3, MID$(Me$, I%, 1), Clr%, 3
  1633.         ELSEIF Mode = 3 THEN
  1634.            GraPrint ((X% * 2) + 9), (Y% * 2.4) + 3, MID$(Me$, I%, 1), Clr%, 3
  1635.         ELSE
  1636.            GraPrint X% + 5, Y% + 3, MID$(Me$, I%, 1), Clr%, 2
  1637.         END IF
  1638.         I% = I% + 1: X% = X% + 16
  1639.     LOOP UNTIL I% > 10
  1640.     IF Mode = 1 THEN
  1641.        LINE (5, 60)-(175, 145), 0, BF: LINE (4, 59)-(176, 146), 3, B
  1642.     END IF
  1643.     I% = 1: READ Count%
  1644.     DO
  1645.         READ X%, Y%, Me$, Fore%, Back%, Scale%
  1646.         IF Mode = 2 THEN
  1647.            GraPrint X% * 2, (Y% * 1.6), Me$, GrAttrib%(Fore%, -1), Scale%
  1648.         ELSEIF Mode = 3 THEN
  1649.            GraPrint X% * 2, (Y% * 2) + 30, Me$, GrAttrib%(Fore%, -1), Scale%
  1650.         ELSE
  1651.            GraPrint X%, Y%, Me$, GrAttrib%(Fore%, Back%), Scale%
  1652.         END IF
  1653.         I% = I% + 1
  1654.     LOOP UNTIL I% > Count%
  1655.     I% = 1: READ Count%
  1656.     DO
  1657.         READ X%, Y%, Me$, Fore%, Back%, Scale%
  1658.         IF Mode = 2 THEN
  1659.            GraPrint X% * 3, (Y% * 1.4), Me$, GrAttrib%(Fore%, -1), Scale%
  1660.         ELSEIF Mode = 3 THEN
  1661.            GraPrint X% * 3, Y% * 1.92, Me$, GrAttrib%(Fore%, -1), Scale%
  1662.         ELSE
  1663.            GraPrint X%, Y%, Me$, GrAttrib%(Fore%, Back%), Scale%
  1664.         END IF
  1665.         I% = I% + 1
  1666.     LOOP UNTIL I% > Count%
  1667.     PLAY "mft255ef#gdef#gef#g#aef#g#ag#abo4co3bo4cdeco3af#gdgbt120g"
  1668.     I% = 1: READ Count%
  1669.     DO
  1670.         READ X%, Y%, Me$, Fore%, Back%, Scale%
  1671.         IF Mode = 2 THEN
  1672.            GraPrint X% * 2, Y% * 1.6, Me$, GrAttrib%(Fore%, -1), 2
  1673.         ELSEIF Mode = 3 THEN
  1674.            GraPrint X% * 2, Y% * 2.2, Me$, GrAttrib%(Fore%, -1), 2
  1675.         ELSE
  1676.            GraPrint X%, Y%, Me$, GrAttrib%(Fore%, Back%), Scale%
  1677.         END IF
  1678.         I% = I% + 1
  1679.     LOOP UNTIL I% > Count%
  1680.     DO: LOOP UNTIL KeyIn% = 32
  1681.     SCREEN 0: WIDTH 80
  1682. GOTO D001
  1683.  
  1684. '┌────────────────────────────────────────────────────────────────────────┐
  1685. '│      Video Panning.                                                    │
  1686. '└────────────────────────────────────────────────────────────────────────┘
  1687. '
  1688. D720:
  1689.     IF (MaxRes% = 13 AND VideoRam% > 64) OR MaxRes% > 9 THEN
  1690.        SCREEN 9: LINE (0, 0)-(639, 349), 9, BF
  1691.        VIEW SCREEN (40, 25)-(600, 325), 0, 15
  1692.        CIRCLE (319, 174), 150, 14: PAINT (319, 174), 14, 14
  1693.        X% = 0: Y% = 0
  1694.        DO
  1695.           KeyPress% = KeyIn%: Pan% = TRUE
  1696.           SELECT CASE KeyPress%
  1697.               CASE -75
  1698.                    IF X% > 0 THEN X% = X% - 1
  1699.               CASE -77
  1700.                    IF X% < 79 THEN X% = X% + 1
  1701.               CASE -72
  1702.                    IF Y% > 0 THEN Y% = Y% - 1
  1703.               CASE -80
  1704.                    IF Y% < 22 THEN Y% = Y% + 1
  1705.               CASE ELSE
  1706.                    Pan% = FALSE
  1707.           END SELECT
  1708.           IF Pan% THEN VGAPan X%, Y% * 5
  1709.        LOOP UNTIL KeyPress% = 27
  1710.        SCREEN 0: WIDTH 80
  1711.     ELSE
  1712.        MisTake 9, "Incompatible Video Card!", 0, Mouse%
  1713.     END IF
  1714. GOTO D001
  1715.  
  1716. '┌────────────────────────────────────────────────────────────────────────┐
  1717. '│      Video Save and Restore.                                           │
  1718. '└────────────────────────────────────────────────────────────────────────┘
  1719. '
  1720. D730:
  1721.     SELECT CASE MaxRes%
  1722.         CASE 7
  1723.              xMax% = 319: yMax% = 199: SaveSize& = 32000
  1724.         CASE 8
  1725.              xMax% = 639: yMax% = 199: SaveSize& = 64000
  1726.         CASE 9, 10
  1727.              xMax% = 639: yMax% = 349: SaveSize& = 112000
  1728.         CASE 11, 12
  1729.              xMax% = 639: yMax% = 479: SaveSize& = 153600
  1730.         CASE 13
  1731.              IF VideoRam% > 64 THEN
  1732.                 xMax% = 639: yMax% = 479: SaveSize& = 153600
  1733.                 MaxRes% = 12
  1734.              ELSE
  1735.                 xMax% = 319: yMax% = 199: SaveSize& = 64000
  1736.              END IF
  1737.         CASE ELSE
  1738.              MisTake 9, "Incompatible Video Card!", 0, Mouse%
  1739.              GOTO D002
  1740.     END SELECT
  1741.     IF Choice% = 4 THEN
  1742.        IF FreeSpace&(0) > SaveSize& THEN
  1743.           SCREEN MaxRes%: RESTORE Escher
  1744.           LINE (0, 0)-(xMax%, yMax%), 6, BF
  1745.           VIEW (32, 4)-(xMax% - 32, yMax% - 4), 0, 5
  1746.           WINDOW SCREEN (0, 0)-(255, 191)
  1747.           FOR I% = 1 TO 40
  1748.               READ A%, B%, C%, D%: LINE (A%, B%)-(C%, D%), 1
  1749.           NEXT I%
  1750.           PAINT (56, 20), 1, 1: PAINT (136, 64), 1, 1
  1751.           PAINT (120, 80), 1, 1: PAINT (192, 88), 14, 1
  1752.           PAINT (76, 48), 14, 1: PAINT (124, 60), 14, 1
  1753.           PAINT (68, 12), 2, 1: PAINT (80, 84), 2, 1
  1754.           PAINT (92, 128), 2, 1: PAINT (36, 156), 12, 1
  1755.           PAINT (36, 168), 1, 1: PAINT (84, 178), 14, 1
  1756.           PAINT (88, 118), 12, 1: PAINT (144, 86), 12, 1
  1757.           VGASave "ESCHER.IMG": KeyPress% = KeyIn%
  1758.        ELSE
  1759.           MisTake 9, "Insufficient disk space!", 0, Mouse%
  1760.        END IF
  1761.     ELSE
  1762.        IF FileSize&("ESCHER.IMG") > 0 THEN
  1763.           SCREEN MaxRes%
  1764.           VGALoad "ESCHER.IMG"
  1765.           KeyPress% = KeyIn%
  1766.        ELSE
  1767.           MisTake 9, "Screen Image file not found!", 0, Mouse%
  1768.        END IF
  1769.     END IF
  1770.     SCREEN 0: WIDTH 80
  1771. GOTO D001
  1772.  
  1773. '┌────────────────────────────────────────────────────────────────────────┐
  1774. '│      Program Exit.                                                     │
  1775. '└────────────────────────────────────────────────────────────────────────┘
  1776. '
  1777. D800:
  1778.     Menu$(0) = "ED#A"
  1779.     Menu$(1) = "&Exit program"
  1780.     Menu$(2) = "&DOS shell"
  1781.     Menu$(4) = "&About DEMON"
  1782.     VerMenu 4, 59, BarColour%, 1, 4, "EXIT", Menu$(),_
  1783.             Choice%, Nxt%, Bar%, 1, RootName$, Mouse%, HotKeys%
  1784.     IF Nxt% THEN GOTO D002
  1785.     SELECT CASE Choice%
  1786.         CASE 1
  1787.              GOTO D810
  1788.         CASE 2
  1789.              GOTO D820
  1790.         CASE 4
  1791.              PopUp 9, 14, 9, 53, BarColour%, 4, 4, -1
  1792.              FastPrint 9, 35, " D E M O N ", BarColour%
  1793.              RESTORE About
  1794.              READ Me$: FastPrint 11, 40 - (LEN(Me$) \ 2), Me$, BarColour%
  1795.              READ Me$: FastPrint 12, 40 - (LEN(Me$) \ 2), Me$, BarColour%
  1796.              READ Me$: FastPrint 13, 40 - (LEN(Me$) \ 2), Me$, BarColour%
  1797.              FastPrint 14, 34, "┌──────────╖", BarColour%
  1798.              FastPrint 15, 34, "│    OK    ║", BarColour%
  1799.              FastPrint 16, 34, "╘══════════╝", BarColour%
  1800.              FastPrint 15, 38, " OK ", 14: Ky% = FALSE
  1801.              IF Mouse% THEN
  1802.                 xHot% = 37 * 8: yHot% = 13 * 8
  1803.                 CALL MouseShow
  1804.              END IF
  1805.              DO
  1806.                 IF KeyStat% THEN
  1807.                    Ky% = KeyIn%
  1808.                 ELSEIF Mouse% THEN
  1809.                    MouseNow LeftButton%, RightButton%, xMouse%, yMouse%
  1810.                    IF LeftButton% THEN
  1811.                       IF yMouse% > yHot% AND yMouse% < yHot% + 16 THEN
  1812.                          IF xMouse% > xHot% AND xMouse% < xHot% + 48 THEN
  1813.                             Ky% = 13
  1814.                          END IF
  1815.                       END IF
  1816.                       DO
  1817.                           MouseNow LeftButton%, RightButton%, xMouse%, yMouse%
  1818.                       LOOP WHILE LeftButton%
  1819.                    END IF
  1820.                 END IF
  1821.              LOOP UNTIL Ky% = 13
  1822.              IF Mouse% THEN MouseHide
  1823.              ShutUp -1
  1824.         CASE ELSE
  1825.     END SELECT
  1826. GOTO D002
  1827.  
  1828. '   Program Exit
  1829. '
  1830. D810:
  1831.     IF Colour% THEN
  1832.        Scroll 1, 1, 1, 25, 80, 0, Attribute%(15, 1)
  1833.        COLOR , , 1: Attrib% = 32
  1834.     ELSE
  1835.        FOR I% = 1 TO 24
  1836.            FastPrint I%, 1, STRING$(80, "░"), 7
  1837.        NEXT I%
  1838.        Attrib% = 112
  1839.     END IF
  1840.     PopUp 3, 2, 9, 44, Attrib%, 3, 2, -1: RESTORE Credits
  1841.     FOR I% = 4 TO 9
  1842.         READ Me$: FastPrint I%, 4, Me$, Attrib%
  1843.     NEXT I%
  1844.     SLEEP 5: KeyFlush
  1845.     IF Colour% THEN Attrib% = 48 ELSE Attrib% = 112
  1846.     PopUp 10, 29, 11, 50, Attrib%, 2, 1, -1
  1847.     FOR I% = 11 TO 19
  1848.         READ Me$: FastPrint I%, 31, Me$, Attrib%
  1849.     NEXT I%
  1850.     SLEEP 10: ShutUp -1: SLEEP 1: ShutUp -1: SLEEP 1
  1851.     CALL KeyFlush: CLS
  1852. GOTO Egress
  1853.  
  1854. '┌────────────────────────────────────────────────────────────────────────┐
  1855. '│      Operating System Shell.                                           │
  1856. '└────────────────────────────────────────────────────────────────────────┘
  1857. '
  1858. D820:
  1859.     Scroll 1, 3, 1, 25, 80, 0, 7
  1860.     Me$ = "Enter the command 'EXIT' when you are ready to return."
  1861.     FastPrint 10, 40 - (LEN(Me$) \ 2), Me$, 14
  1862.     LOCATE 13, 1, 1: ON ERROR GOTO D821
  1863.     SHELL
  1864.     ON ERROR GOTO Trap
  1865.     GOTO D001
  1866. D821:
  1867.     ON ERROR GOTO Trap
  1868.     IF ERR = 5 THEN
  1869.        MisTake 9, "Cannot load secondary Command Processor", 0, Mouse%
  1870.        RESUME D800
  1871.     END IF
  1872.  
  1873. '┌────────────────────────────────────────────────────────────────────────┐
  1874. '│      Error Trap.                                                       │
  1875. '└────────────────────────────────────────────────────────────────────────┘
  1876. '
  1877. Trap:
  1878.     Fatal% = TRUE
  1879.     SELECT CASE ERR
  1880.         CASE 7, 14
  1881.              Me$ = "Out of memory"
  1882.         CASE 27
  1883.              Me$ = "PRINTER NOT READY": Fatal% = FALSE
  1884.         CASE 61, 67
  1885.              Me$ = "Out of disk space"
  1886.         CASE 71
  1887.              Me$ = "DISK DRIVE NOT READY": Fatal% = FALSE
  1888.         CASE 72
  1889.              Me$ = "Disk media error"
  1890.         CASE ELSE
  1891.              A$ = STR$(ERR): Me$ = "A type" + A$ + " Error has just occurred"
  1892.     END SELECT
  1893.     IF Fatal% THEN
  1894.        Me$ = Me$ + ", aborting to DOS ..."
  1895.        SL% = StatusLine%(Me$)
  1896.        RESUME Egress
  1897.     ELSE
  1898.        ML% = LEN(Me$): MT% = 40 - (ML% \ 2)
  1899.        IF Colour% THEN Attrib% = 78 ELSE Attrib% = 112
  1900.        PopUp 9, 20, 7, 42, Attrib%, 3, 2, -1
  1901.        FastPrint 10, MT%, Me$, Attrib% + 128: BEEP
  1902.        Me$ = "Please correct this error if possible"
  1903.        FastPrint 12, 22, Me$, Attrib%
  1904.        FastPrint 13, 30, "Press a key when ready", Attrib%
  1905.        FastPrint 14, 32, "or <ESC> to Abort.", Attrib%
  1906.        Character% = KeyIn%: ShutUp -1
  1907.        IF Character% = 27 THEN RESUME Egress
  1908.        RESUME
  1909.     END IF
  1910. Egress:
  1911.     Attr% = SCREEN(20, 1, 1)
  1912.     Curtains 25, 255: Curtains 25, 31: Curtains 25, Attr%
  1913.     LOCATE 20, 1, 1: ClearEnd 1, Attr%
  1914. END
  1915.  
  1916. '┌────────────────────────────────────────────────────────────────────────┐
  1917. '│     Program specific functions and procedures.                         │
  1918. '└────────────────────────────────────────────────────────────────────────┘
  1919. '
  1920. '   Draws or refreshes the main display screen. If switch is zero, only the
  1921. '   status line is refreshed.
  1922. '
  1923. SUB Frame (Title$, Switch%) STATIC
  1924.     SHARED StatColour%, HeadColour%, TextColour%, ToDay$
  1925.     IF Switch% THEN
  1926.        Scroll 1, 1, 1, 3, 80, 0, HeadColour%
  1927.        IF Title$ <> "" THEN
  1928.           FastPrint 1, 40 - (LEN(Title$) \ 2), Title$, HeadColour%
  1929.        END IF
  1930.        FastPrint 2, 1, STRING$(80, "─"), HeadColour%
  1931.        Panel 4, 1, 21, 80, 1, TextColour%
  1932.     END IF
  1933.     FastPrint 25, 1, SPACE$(80), StatColour%
  1934.     FastPrint 25, 4, "Press <F1> for Help, <ESC> to Abort", StatColour%
  1935.     IF ToDay$ <> "" THEN
  1936.        FastPrint 25, 78 - LEN(ToDay$), ToDay$, StatColour%
  1937.     END IF
  1938. END SUB
  1939.  
  1940. '┌────────────────────────────────────────────────────────────────────────┐
  1941. '│     Data Division.                                                     │
  1942. '└────────────────────────────────────────────────────────────────────────┘
  1943. '
  1944. Blurb:
  1945.     DATA "The Library modules on this disk provide you"
  1946.     DATA "with all the facilities necessary for you to"
  1947.     DATA "implement a full range of window features in"
  1948.     DATA "your programs.  With just one statement, for"
  1949.     DATA "instance, you can 'Pop-up' a window onto the"
  1950.     DATA "screen."
  1951.     DATA "The window can be a simple rectangle, in any"
  1952.     DATA "the QuickBASIC background colors, such as .."
  1953.     DATA "Alternatively it may have a border in one of"
  1954.     DATA "eight styles ...."
  1955.     DATA "The border itself may be in any one of the"
  1956.     DATA "QuickBASIC foreground colors. It can blink"
  1957.     DATA "if you want it to ..."
  1958.     DATA "The window, too, can be presented in several"
  1959.     DATA "different ways. It can be flat..."
  1960.     DATA "or it can have a black shadow underneath, to"
  1961.     DATA "give a three-dimensional effect..."
  1962.     DATA "Once you have a window on the screen, simply"
  1963.     DATA "use FASTPRINT, also in the TOOLBOX Library, "
  1964.     DATA "to put text into it, in any colour you like."
  1965.     DATA "You can also use the SCROLL routine from the"
  1966.     DATA "same source, to clear the window's contents."
  1967.     DATA "All the functions in the Library are written"
  1968.     DATA "in fast assembly language, but this does not"
  1969.     DATA "prevent them from being very easy to use."
  1970.     DATA "This for instance, is the call to create the"
  1971.     DATA "present window ....."
  1972.     DATA "   PopUp 8, 14, 8, 52, 112, 2, 0, -1"
  1973.     DATA "Before opening a window, the function stores"
  1974.     DATA "the screen beneath it in an internal buffer."
  1975.     DATA "When you close a window, the screen contents"
  1976.     DATA "are restored to their original location. Use"
  1977.     DATA "the statement 'ShutUp -1' to close the last"
  1978.     DATA "window opened.  For example ...."
  1979.     DATA "The Library includes several functions which"
  1980.     DATA "apply windowing techniques. The HELP screen,"
  1981.     DATA "which is available at the front menu, is one"
  1982.     DATA "example. Another is the VERIFY BOX which you"
  1983.     DATA "can use to collect a Yes/No response from an"
  1984.     DATA "operator, without redrawing the display."
  1985.     DATA "Another utility is the STATUS LINE MESSAGE,"
  1986.     DATA "which can be used to pause execution of the"
  1987.     DATA "program until the operator presses a key."
  1988.     DATA "You can display any prompt message you like"
  1989.     DATA "and the function will return the ASCII code"
  1990.     DATA "of the key which was pressed."
  1991.     DATA "I often use StatusLine in conjunction with a"
  1992.     DATA "routine which checks if the printer is ready"
  1993.     DATA "or not.  This gives the user a chance to fix"
  1994.     DATA "the printer,  if it is just out of paper, or"
  1995.     DATA "to abandon printing, if it is a more serious"
  1996.     DATA "problem. PrinTest is included here too."
  1997.  
  1998. Flags:
  1999.     DATA "The ASSEMBLY-LANGUAGE TOOLBOX includes a"
  2000.     DATA "pair  of functions which give you access"
  2001.     DATA "to  the  INTRA-APPLICATION COMMUNICATION"
  2002.     DATA "AREA (IAC),  an area of memory which has"
  2003.     DATA "been reserved,  by DOS, so that programs"
  2004.     DATA "can communicate with each other. The IAC"
  2005.     DATA "is 16 bytes long and is located,  in low"
  2006.     DATA "RAM at addresses 0000:04F0 - 04FF (Hex)."
  2007.     DATA "Once set, an IAC flag retains it's value"
  2008.     DATA "until  you reset it,  or the computer is"
  2009.     DATA "rebooted."
  2010.     DATA "Since QuickBASIC programs, compiled with"
  2011.     DATA "the /O switch to run stand-alone, cannot"
  2012.     DATA "pass variables to chain modules, you can"
  2013.     DATA "use  this feature to implement a limited"
  2014.     DATA "form of parameter passing."
  2015.     DATA "1.4F0h       9.4F8h", "2.4F1h      10.4F9h"
  2016.     DATA "3.4F2h      11.4FAh", "4.4F3h      12.4FBh"
  2017.     DATA "5.4F4h      13.4FCh", "6.4F5h      14.4FDh"
  2018.     DATA "7.4F6h      15.4FEh", "8.4F7h      16.4FFh"
  2019.     DATA 10, 59, 11, 59, 12, 59, 13, 59, 14, 59, 15, 59
  2020.     DATA 16, 59, 17, 59, 10, 72, 11, 72, 12, 72, 13, 72
  2021.     DATA 14, 72, 15, 72, 16, 72, 17, 72
  2022.  
  2023. Finder:
  2024.     DATA "This function allows you to find out if a particular"
  2025.     DATA "file is present on any disk drive in the system."," "
  2026.     DATA "Enter the name of the file which you want to locate,"
  2027.     DATA "including the drive letter and directory pathname if"
  2028.     DATA "required.  You can use an ambiguous name,  including"
  2029.     DATA "the wildcard characters (* and ?).  In this case the"
  2030.     DATA "function will pop up a directory window containing a"
  2031.     DATA "list of all files that match. You can select the one"
  2032.     DATA "you are interested in,  by high-lighting it with the"
  2033.     DATA "cursor arrow keys and pressing <RETURN>. The routine"
  2034.     DATA "returns a string containing the full pathname of the"
  2035.     DATA "file which you have selected."
  2036.  
  2037. Sorts:
  2038.     DATA "SORTFILE sorts ASCII text files. You supply the name, which may"
  2039.     DATA "include a directory pathname, and the start position and length"
  2040.     DATA "of the field which the file is to be sorted on.", " "
  2041.     DATA "The program first checks the size of the file and the amount of"
  2042.     DATA "free disk space to see if the it can be sorted in memory, this"
  2043.     DATA "requires space for two copies of the file on disk. If it is too"
  2044.     DATA "large, the file is sorted in place so that no extra disk space"
  2045.     DATA "is required. Using this method, which is far slower, the file"
  2046.     DATA "may be of any size up to 4 Gigabytes."
  2047.  
  2048. Size:
  2049.     DATA "THIS PROGRAM REPORTS THE SIZE OF FILES WHICH YOU SPECIFY"
  2050.     DATA "--------------------------------------------------------", " "
  2051.     DATA "The filename can include a directory path and may be ambiguous,"
  2052.     DATA "using the wildcard characters '*' and '?'. The program will"
  2053.     DATA "return the size of the file, in bytes, or, if more than one"
  2054.     DATA "match is found, the total size of all the files. If a size of"
  2055.     DATA "zero is returned, the file does not exist (at least not in the"
  2056.     DATA "directory specified).", " "
  2057.     DATA "Type in the pathname required (no more than 64 characters) or"
  2058.     DATA "Enter an empty string to quit."
  2059.  
  2060. KeyBuff:
  2061.     DATA 19, 6, 4, "Head Tail", 6, 33, "Keyboard Buffer"
  2062.     DATA  6, 67, "Buffer Area", 8, 4, "041A 041C"
  2063.     DATA  8, 17, "1E 20 22 24 26 28 2A 2C 2E 30 32 34 36 38 3A 3C"
  2064.     DATA  8, 68, "0480 0482", 10, 3, "┌────┬────┐"
  2065.     DATA 10, 16, "┌──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┐"
  2066.     DATA 10, 67, "┌────┬────┐",11, 3,"│         │", 11, 16, "│"
  2067.     DATA 11, 64, "│", 11, 67, "│         │", 12, 3, "└────┴────┘"
  2068.     DATA 12, 16, "└──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┘"
  2069.     DATA 12, 67, "└────┴────┘", 14, 3, "ASCII Codes"
  2070.     DATA 14, 67, "Waiting", 15, 3, "Scan Codes"
  2071.  
  2072. HWare:
  2073.     DATA "Unknown computer type", "PC", "PC/XT", "PCjr"
  2074.     DATA "PC/AT, PS/2 Model 50/60", "PC/XT", "PS/2 Model 30"
  2075.     DATA "PC Convertible", "PS/2 Model 80"
  2076.  
  2077. Shift:
  2078.     DATA "Left & Right SHIFT keys pressed", "CTRL key pressed"
  2079.     DATA "ALT key pressed", "SCROLL LOCK active"
  2080.     DATA "NUM LOCK active", "CAPS LOCK active"
  2081.     DATA "INSERT key status", "Left CTRL key pressed"
  2082.     DATA "Left ALT key pressed", "SYS REQ key pressed"
  2083.     DATA "PAUSE (or CTRL-NUM LOCK) active", "SCROLL LOCK pressed"
  2084.     DATA "NUM LOCK pressed", "CAPS LOCK pressed"
  2085.     DATA "INSERT key pressed"
  2086.  
  2087. Numbers:
  2088.     DATA 8, 1, 125678, 125678, 158, 158, 158, 158, 123458, 123458
  2089.     DATA 8, 4, 1278, 1278, 18, 148, 148, 148, F, 1235678
  2090.     DATA 8, 5, 12345, 12345, 5, 5, 45678, 45678, 5, 5
  2091.     DATA 8, 6, 12348, 12348, 148, 148, 148, 148, 145678, 145678
  2092.  
  2093. Crypt:
  2094.     DATA "This routine requires that you supply two strings of
  2095.     DATA "characters. The first is the text to be encrypted, and"
  2096.     DATA "the second is one or more keywords which are used to"
  2097.     DATA "encipher the text. Thereafter, the text cannot be"
  2098.     DATA "decrypted until you supply the same key string again."
  2099.  
  2100. Strings:
  2101.     DATA "Building a 1000 element, variable-length, string array"
  2102.     DATA "in memory and filling it with random data .... "
  2103.     DATA "Sort into Ascending or Descending order (A/D) [ ]"
  2104.  
  2105. Path:
  2106.     DATA "By default, the Toolbox Help system looks for its'"
  2107.     DATA "topic files in a subdirectory called HELP, beneath"
  2108.     DATA "the currently-logged directory.  You can, however,"
  2109.     DATA "direct it to look elsewhere for files by setting a"
  2110.     DATA "HELP variable in the DOS environment table;",""
  2111.     DATA "e.g.  SET HELP=C:\BASIC\TOOLBOX\HELP",""
  2112.     DATA "Alternatively, you can use the QuickBASIC ENVIRON"
  2113.     DATA "statement within your program, to point HELPMATE to"
  2114.     DATA "the appropriate pathname. Remember, 'though, that"
  2115.     DATA "this method only remains in effect as long as the"
  2116.     DATA "current program is running."
  2117.     DATA "The current HELP environment pathname is"
  2118.     DATA "Enter replacement or press <Esc> to leave unchanged"
  2119.  
  2120. Title:
  2121.     DATA 1, 2, 2, 2, 29, 0, 92, 23, 95
  2122.     DATA 64, 98, 104, 101, 135, 103, 102, 106, 65, 112, 30, 115
  2123.     DATA 10, 119, 5, 122, 3, 125, 5, 128, 10, 131, 30, 136, 65, 142
  2124.     DATA 221, 165, 320, 165, 320, 156, 35, 125, 27, 122, 35, 119
  2125.     DATA 65, 112, 102, 106, 135, 103, 149, 102, 162, 101, 195, 98
  2126.     DATA 240, 92, 272, 90, 304, 92, 320, 94
  2127.     DATA 0, 6, 6, 167, 8, 320, 94, 304, 92
  2128.     DATA 272, 90, 240, 92, 195, 98, 162, 101, 149, 102, 135, 103
  2129.     DATA 102, 106, 82, 109
  2130.     DATA 3, 7, 7, 90, 6, 220, 85, 220, 98
  2131.     DATA 300, 98, 300, 86, 305, 86, 260, 73, 215, 86, 220, 86
  2132.     DATA 0, 6, 6, 167
  2133.  
  2134.     DATA 6
  2135.     DATA 15, 65, "Professional Edition", 15, -1, 1
  2136.     DATA 15, 75, "available from...", 15, -1, 1
  2137.     DATA 15, 95, "ARDEN Software Ltd", 15, -1, 1
  2138.     DATA 15, 105, "115/117 Barkby Road", 15, -1, 1
  2139.     DATA 15, 115, "Leicester LE4 7LG", 15, -1, 1
  2140.     DATA 15, 134, "Tel. (0533)-761524", 15, -1, 1
  2141.     DATA 2
  2142.     DATA 8, 172, "for TOOLBOX support", 14, 0, 2
  2143.     DATA 8, 172, "    TOOLBOX", 13, -1, 2
  2144.     DATA 2
  2145.     DATA 39, 192, "Press the SPACE BAR to continue", 11, 0, 1
  2146.     DATA 39, 192, "          SPACE BAR", 15, -1, 1
  2147.  
  2148. Escher:
  2149.     DATA 68,4,200,76,52,12,112,44,128,52,172,76,128,52,68,84,112,44,84,60
  2150.     DATA 128,68,99,84,68,36,97,52,128,68,154,84,128,68,128,116,128,52,128
  2151.     DATA 68,68,4,52,12,172,76,142,90,142,76,142,108,142,108,200,76,200,76
  2152.     DATA 200,92,200,92,68,164,128,116,84,140,52,12,52,154,52,154,68,164
  2153.     DATA 68,164,68,100,68,36,68,84,84,45,84,76,84,109,84,140,68,100,97,116
  2154.     DATA 84,124,112,108,68,84,128,116,84,76,112,92,112,77,112,108,84,119
  2155.     DATA 92,114,142,86,151,82,180,66,186,62,186,62,236,90,236,90,68,184
  2156.     DATA 68,184,16,154,16,154,52,133,16,154,16,160,16,160,68,190,68,190
  2157.     DATA 68,184,68,190,236,96,236,96,236,90
  2158.  
  2159. About:
  2160.     DATA "Assembly-Language Toolbox demonstration program"
  2161.     DATA "(c)1988 Christy Gemmell and Singular Software"
  2162.     DATA "Release 5.23  April 1992"
  2163.  
  2164. Credits:
  2165.     DATA "   The Assembly-Language Toolbox for   "
  2166.     DATA "          Microsoft QuickBASIC         "
  2167.     DATA "    Professional Edition, Release 5    "
  2168.     DATA "                                       "
  2169.     DATA "is available for QuickBASIC 4.5 and the"
  2170.     DATA "BASIC 7 Professional Development System"
  2171.  
  2172.     DATA "The Professional Edition contains source code,"
  2173.     DATA "object files, stand-alone and Quick libraries"
  2174.     DATA "and a complete set of documentation. To order"
  2175.     DATA "your copy, contact....", ""
  2176.     DATA "Neil Carter:         ARDEN Software Ltd"
  2177.     DATA "                     115/117 Barkby Road"
  2178.     DATA "                     Leicester LE4 7LG"
  2179.     DATA "Tel. (0533)-761524   Fax. (0533)-740249"
  2180.  
  2181. '┌────────────────────────────────────────────────────────────────────────┐
  2182. '│      (c) 1988,1991 By Christy Gemmell and Singular Software.           │
  2183. '└────────────────────────────────────────────────────────────────────────┘
  2184.